I've got a simple view that creates a link if a login is successful and is located under /Login:
<div>
@Html.ActionLink("Add a new Organization", "AddOrganization",
"/Setup/AddOrganizationController", new { id = Session["ID"] }, null)
</div>
After reading other similiar problems, I tried it adding the null after, as well as a few other overloads, but I can't get the link to work right. When I click the link, it takes me to
http://setup/AddOrganizationController/AddOrganization
Which is leaving out the localhost part that needs to be there. Without the null at the end, it tries to send me to
/Login/AddOrganization
All I want is a link that will run an action within the AddOrganizationController controller which is under /Setup directory. The link should also pass the session id to the controller as an argument. How can I do this?
If it's in the same Area
then you can just do:
@Html.ActionLink("Add a new Organization", "AddOrganization", "Organizations", new { id = Session["ID"] })
where "Organizations" is the controller name.
Otherwise, if it's in another area you would do something like
@Html.ActionLink("Add a new Organization", "AddOrganization", "Organizations", new { area = "areaName", id = Session["ID"] }, null)