asp.net mvc - Routing issue in Global file -


routes information

routes.maproute(         "default", // route name         "{controller}/{action}/{id}", // url parameters        new { controller = "home", action = "index", id = urlparameter.optional }          // parameter defaults             );  routes.maproute(         "default1", // route name         "{controller}/{id}", // url parameters         new { controller = "home", action = "index", id = urlparameter.optional } // parameter defaults             ); 

url information

http://localhost:24060/home/22323      //failed http://localhost:24060/home/index/22323    //passed\ 

query, how can pass both url ?

you have map default route last. should create constraint in other route not block default route.

routes.maproute(         "default1",         "{controller}/{id}",         new { controller = "home", action = "index", id = urlparameter.optional },         new { id = @"\d+" });         //second segment has integer, otherwise skip route.  routes.maproute(         "default",         "{controller}/{action}/{id}",        new { controller = "home", action = "index", id = urlparameter.optional }); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -