Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3951310
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:42:57+00:00 2026-05-20T01:42:57+00:00

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

  • 0

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 is not working, but when I use context.MapRoute on the last route it works but the GetVirtualPath in my custom route is not used for actionlinks. I thought that MapRoute was just an extension to context.Routes.Add? What is the best way to debug routes? I have used Phil Haacks route debug but it does not work with my custom route, is there any other way to debug routes?

I really need some help here.
My route registrations in my dashboard area 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 }
        );

The PageRoute is a custom route and you can find the code here http://bit.ly/er6HPn
With this routes active a link like this works great Html.ActionLink(“Manage Roles”, “manageroles”, “account”) but when I have a link that should work with my custom route like this Html.ActionLink(page.MetaData.Name, “edit”, “pages”, new { document = page },null) the result is http://stormbreaker.local/dashboard/pages/edit?document=Stormbreaker.Example.Models.Page, this means that GetVirtualPath in my PageRoute is never used. Can anyone explain to me way and how I could fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:42:58+00:00Added an answer on May 20, 2026 at 1:42 am

    Solved it, If you register a custom RouteBase instance in the RouteCollection object, IRouteWithArea interface lets you associate that RouteBase instance with an area

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two models with a has-many/belongs-to relationship. The routes are nested, and I
I have two EC2 instances behind a Amazon load balancer. The load balancer routes
So basically I have two models, Entry and Comment. I have the association setup
I have two different models that can show up in a category. In my
OK I have two different controllers, say controllerA and controllerB, Now from within controllerA
Background Info: I have two COM+ components on a remote server, based on .NET
This is my goal: I need to two (or more) Areas for my MVC
I think I am thinking about routing all wrong. I have a very simple,
Probably a trivial question, but I want to get the best possible solution. Problem:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.