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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -