I understand that this is an old question, but I will answer it if someone else tries to figure it out. The solution to this is to create areas that use a different routing value at a lower level than the area, so for example, your RouteConfig will look something like this:
public class RouteConfig { /// <summary> /// A function that registers the default navigation route. /// </summary> /// <param name="routes">The RouteCollection to act on.</param> public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); var route = routes.MapRoute( name: "Default", url: "{area}/{subArea}/{controller}/{action}/{id}", defaults: new { area = "DefaultArea", controller = "Home", action = "Splash", id = UrlParameter.Optional, section = "Customer" }, namespaces: new string[] { "Application.Controllers" }); } }
And one of your subzone registrations might look like this:
public class ApplicationSubAreaRegistration : AreaRegistration { public override string AreaName { get { return "ApplicationSubArea"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "SubArea_default", "Area/SubArea/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new string[] { "Application.Areas.AreaName.SubAreaName.Controllers" } ); } }
After reading this question, does "area" still look like a word? Because it is not for me.
PS You can do this recursively as many times as you want (theoretically), for example, you could do
url: "{area}/{subArea}/{subSubArea}/{subSubSubArea}/{evenMoreSubArea}/{controller}/{action}/{id}",
in your RouteConfig.cs and
"Area/SubArea/SubSubArea/SubSubSubArea/EvenMoreSubArea/{controller}/{action}/{id}",
in your area.
Ceshion
source share