Register routes in the registration area

I have two routes in my area, one custom and one default fallback route, see below

        var dashboardRoute = new DashboardRoute(
            ObjectFactory.GetInstance<PathResolver>(),
            ObjectFactory.GetInstance<VirtualPathResolver>(),
            null);
        context.Routes.Add(dashboardRoute);

        context.Routes.MapRoute(
            "Dashboard_Default", // Route name
            "dashboard/{controller}/{action}/{id}", // URL with parameters
            new { controller = "pages", action = "index", id = UrlParameter.Optional, area = "Dashboard" } // Parameter defaults
        );

when I add both routes using context.Routes.Add / MapRoute the last route does not work, but when I use context.MapRoute on the last route it works, but GetVirtualPath is not used for actionlinks in my custom route. I thought MapRoute was just a context extension. Routes.Add? What is the best way to debug routes? I used Phil Haacks to debug a route, but it doesn’t work with my custom route, is there any other way to debug routes?

I really need help here. My registration of routes in the area of ​​my panel looks like this:

        var dashboardRoute = new PagesRoute(
            ObjectFactory.GetInstance<PathResolver>(),
            ObjectFactory.GetInstance<VirtualPathResolver>(),
            null);
        context.Routes.Add("Dashboard", dashboardRoute);

        context.MapRoute(
            "Dashboard_default",
            "dashboard/{controller}/{action}/{id}",
            new { controller = "dashboard", action = "index", id = UrlParameter.Optional }
        );

PageRoute - , http://bit.ly/er6HPn Html.ActionLink( " ", "", " " ), , , Html.ActionLink(page.MetaData. , "", "", { = }, ) http://stormbreaker.local/dashboard/pages/edit?document=Stormbreaker.Example.Models.Page, , GetVirtualPath PageRoute . - ?

+5
1

. RouteBase RouteCollection, IRouteWithArea RouteBase

+7

All Articles