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 5991919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:27:26+00:00 2026-05-22T23:27:26+00:00

I have 4 routes defined 5 different urls. Tested a lot with RouteDebugger but

  • 0

I have 4 routes defined 5 different urls. Tested a lot with RouteDebugger but can not solve.

The problem is that Top 2 links always use {controller}/{action}/{id} this route which is root1 and can not redirect to proper pages.

Links

@Html.ActionLink("Go Index by name", "Page", "Home", new { name="contact"}, null)

@Html.ActionLink("Go Index by id", "Index", "Admin", new { id=2}, null)


@Html.ActionLink("Go Index by id and name", "Page", "Home", new { name = "contact", id = 2 }, null)


@Html.ActionLink("Root Admin", "Index", "Admin")


@Html.ActionLink("Root", "Index", "Home")

Here is the Map.Route

    routes.MapRoute("root1",
      "{controller}/{action}/{id}",
       new { controller = "Admin", action = "Index" });

    routes.MapRoute("root2",
        "{controller}/{action}/{name}",
        new { controller = "Home", action = "Page" });

    routes.MapRoute("root3", 
        "{controller}/{action}/{name}/{id}", 
        new { controller = "Home", action = "Page" });

    routes.MapRoute("root4", 
        "{controller}/{action}/{name}", 
        new { controller = "Home", action = "Index", name = UrlParameter.Optional });
  • 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-22T23:27:27+00:00Added an answer on May 22, 2026 at 11:27 pm

    These are the routes I have set up and it seems to hit each one correctly.

    Note that root3 has been moved to the top since root2 will match that as well. also, the validation for root1 with id as King Julian suggested

    The route:

    @Html.ActionLink("Root Admin", "Index", "Admin")
    

    should not match root1 nor root2 since there is no default for id and name respectively in the route definition

    routes.MapRoute("root3",
         "{controller}/{action}/{name}/{id}",
          new { controller = "Home", action = "Page" });
    
    routes.MapRoute("root1",
          "{controller}/{action}/{id}",
          new { controller = "Admin", action = "Index" },
          new { id = @"\d+" });
    
    routes.MapRoute("root2",
          "{controller}/{action}/{name}",
          new { controller = "Home", action = "Page" });
    
    routes.MapRoute("root4",
          "{controller}/{action}/{name}",
          new { controller = "Home", action = "Index", name = UrlParameter.Optional     
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(This is not exactly the problem that I have, but it's isomorphic, and I
I have my own routing rules in routes.php, defined for all the pages that
I have two routes defined in different JS-documents, although both are included into the
Zend Project with multiple modules and every modules have its own routes.ini defined inside
In my MVC application I have a default route defined: routes.MapRoute( Default, // Route
In express, I have defined some routes app.post(/api/v1/client, Client.create); app.get(/api/v1/client, Client.get); ... I have
I have the following route's defined: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute({resource}.axd/{*pathInfo}); routes.MapRoute(
I have routes like: /, /login, /register, etc that work fine in dev environment.
I have an MVC app which has its routes defined with the final route
I have done some searching around but have not been able to figure out

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.