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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:39:34+00:00 2026-06-09T01:39:34+00:00

i have two folder under view folder. one is Home and that has index.aspx

  • 0

i have two folder under view folder. one is Home and that has index.aspx file
another folder in view folder called DashBoard and that has MyDash.aspx

my routing code look like in global.asax

        public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

        routes.MapRoute(
        "DashBoard", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "DashBoard", action = "MyDash", id = UrlParameter.Optional } // Parameter defaults
        );
    }

so when i type url like http://localhost:7221/ or http://localhost:7221/Home then index.aspx is being render from Home folder but when i type url like http://localhost:7221/DashBoard then page not found is coming but if i type like http://localhost:7221/DashBoard/MyDash then page is coming.

so what is wrong in my second routing code . why MyDash.aspx is not coming when i type url like http://localhost:7221/DashBoard. what is wrong?

what i need to change in my second routing code??

please have a look…..i am new in MVC. thanks

My UPDATE

when i change route entry in global.asax file then it started working.
can u please explain why….

            routes.MapRoute(
                "DashBoard",
                "DashBoard/{action}/{id}",
                 new { controller = "DashBoard", action = "MyDash", id = UrlParameter.Optional }
            );

        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );

can i write routing code this way

 routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional },
            new { controller = "DashBoard", action = "MyDash", id = UrlParameter.Optional } 
);

same pattern for two url….please discuss in detail. thanks

  • 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-06-09T01:39:36+00:00Added an answer on June 9, 2026 at 1:39 am

    The route names (1st parameter) have no impact on what action/controller gets invoked.

    Your 2 route patterns, however, (2nd paramters of routes.MapRoute) are identical :

    "{controller}/{action}/{id}"
    

    … so anything that would be matched by the 2nd pattern gets caught by the first pattern. Therefore they’re all getting mapped by the first map definition.

    http://localhost:7221/Home works because it matches the first pattern, and presumably, the Index action exists inside your Home controller.

    http://localhost:7221/DashBoard/MyDash works because, even though it’s getting matched by the 1st route, it overrides the default action/controller (Home/Index) by the route parameters passed in through the URL (DashBoard/MyDash).

    http://localhost:7221/DashBoard doesn’t work because it’s getting picked up by the first route pattern, but you didn’t pass in an action name, so it looks for the default — Index — which I’m guessing you haven’t set up within the DashBoard controller.

    UPDATE (how to fix the problem):
    So if you want http://localhost:7221/DashBoard to map to Controller named DashBoard with an action named MyDash, while still allowing other patterns to be picked up by {controller}/{action}/{id} delete your 2nd route, and place this one as the 1st route:

    routes.MapRoute(
            "DashBoard", 
            "DashBoard/{action}/{id}",
             new { controller = "DashBoard", action = "MyDash", id = UrlParameter.Optional }               
        );
    

    This is a more specific route, so it needs to go before the catch-all {controller}/{action}/{id}. Nothing that doesn’t start with /DashBoard will get picked up by it.

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

Sidebar

Related Questions

Suppose i have one folder and inside that another two files are there .
I have two applications in codeigniter. Called App1 and App2 under application folder. i
I have two tables: Folder, Files. Each table has 4 fields: ParentID, ID, Name,
I have a folder with two files: Awesome.File.20091031_123002.txt Awesome.File.Summary.20091031_123152.txt Additionally, a third-party app handles
I have one folder synced between two computers (using one of online sync tools).
I have three files in a folder 'test' one.php two.php print.html And i have
I have a folder with a few background images (one.jpg, two.jpg, three.jpg) , and
I have two branches in my repository(SAMPLE) master .. under Master ---> AA (folder)-->
I have two applications under tomcat/webapps folder. tomcat/webapps/App1 tomcat/webapps/App2 Both applications share the same
I have created a web application in that application i have added two folder.

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.