Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public static void RegisterRoutes(RouteCollection routes)
       {
           routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

           routes.MapRoute(
               name: "DefaultOne",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
           );
           routes.MapRoute(
               name: "DefaultTwo",
               url: "{controller}/{action}/{id}",
               defaults: new { controller = "Patient", action = "Index", id = UrlParameter.Optional }
           );
       }


What I have tried:

whenever i run the application by default Home Controller is calling. how does routeconfig know which route should call first.
Posted
Updated 6-Apr-17 6:16am

1 solution

It goes through the registered routes from the start, one at a time, until a match is found. Since the Home route is first in the list, it'll match first.
 
Share this answer
 
Comments
raxhemanth 6-Apr-17 12:27pm    
Thankyou Dave got it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900