I can’t get this to stick, it should stay the same when clicked but it appends the first two directories to it after it redirects:
<a href="~/Main/Content/Company/@Model.CompanyId/RemoveCompany"> remove </a>
When I click it, the browser tries to redirect to http://localhost/Main/Content/Companies/68/~/Main/Content/Company/68/RemoveCompany
tried this too
<a href="/Main/Content/Company/@Model.CompanyId/RemoveCompany"> remove </a>
redirects to http://localhost/Main/Companies/Main/Content/Company/0/RemoveCompany
the route looks like this in our Main Area:
context.MapRoute("RemoveCompany", "Main/Content/Company/{id}/RemoveCompany", new { controller = "Company", action = "RemoveCompany", id = UrlParameter.Optional });
Did you try using a helper?
or even better: Routes – the kind of standard things people use in ASP.NET MVC. Seems like you are trying to hit a controller action belonging to an area or something. So simply setup your routes and get going:
given the following Main area registration:
yields: