I have 2 areas Admin
and FrontEnd
(in that order).
When I am in a view in my FrontEnd area, ActionLink
always points to the Admin
area:
@Html.ActionLink("Checkout", "Address", "Checkout")
Will be http://localhost:53600/admin/Checkout/Address
but the Checkout controller is in my FrontEnd area.
I know I can solve this by specifying a routedata object in the action link and setting area = "FrontEnd"
but I don't want to. I want the ActionLink
helper to default to my current route.
Is this possible?
All the questions I've read on actionlink are people asking how to link to another area which indicates it defaults to the current area for them. Am I alone with this issue?
Edit, these are my routes which you can see are tied to the correct namespace:
Admin
public void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
"Administration_default",
"admin/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", area = "Administration", id = UrlParameter.Optional },
new[] { "CC.Web.Areas.Administration.Controllers" }
);
}
FrontEnd
public void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute("Default",
"{controller}/{action}/{id}",
new {controller = "Home", action = "Index", area = "FrontEnd", id = UrlParameter.Optional},
new[] {"CC.Web.Areas.FrontEnd.Controllers"}
);
}