I have a mvc application Areas folder structure of the following type:
Areas => FolderA => Controllers => ControllerA & ControllerB
I have used the following register path in AreaRegistration:
context.MapRoute(
"default1",
"FolderA/{controller}/{action}/{id}",
new { controller = "ControllerA|ControllerB", action = "Index", id = UrlParameter.Optional }
);
and I have two links on a shared layout as:
@Html.ActionLink("Link 1", "ActionA", "ControllerA", null)
@Html.ActionLink("Link 2", "ActionB", "ControllerB", null)
Link 1 seems to be working fine and redirects as expected. Issue is with Link2, which always forms the following url and i get 404 error.
http://localhost:29661/FolderA/ControllerA/ActionB?Length=15
The default application route path is:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
Seems like it is always looking for ActionB in the same controller, even i have 2 different paths registered. Can anyone please help it out.