c# - Keep getting 404 eventhough I mapped my routes -


i have been dealing issues routes. have defined routes keep getting 404. here routes :

routes.maproute(     name: "default",     url: "{controller}",     defaults: new { controller = "login", action = "login" } );  routes.maproute(     name: "home",     url: "{controller}/{date}",     defaults: new { controller = "home", action = "home", date = urlparameter.optional } );  routes.maproute(     name: "calendar",     url: "{controller}/{action}",     defaults: new { controller = "calendar", action = "index" } );  routes.maproute(     name: "act",     url: "{controller}",     defaults: new { controller = "act", action = "new" } );  localhost:51081/login works!  localhost:51081/home/25.04.2013 works!  localhost:51081/act doesnt work!  localhost:51081/calendar/index doesnt work! 

here "login" , "home" works "calendar" , "act" doesnt. when move "calendar" mapping top "home" mapping doesnt work. how map pages?

basically dont want action name appear on url ex : http://localhost:51081/home/home/25.04.2013. want see http://localhost:51081/home/25.04.2013 or http://localhost:51081/calendar

like @marcgravell says: add special rules exceptions

in case routes calendar , home same. can map routes more specific replacing {controller} home, cause route isn't dynamic , exception(it ignores action)

  routes.maproute(             name: "home",             url: "home/{date}",             defaults: new { controller = "home", action = "home", date = urlparameter.optional }         ); 

act same calendar don't need 2 routes those. call act/new instead of act.

for default use:

routes.maproute(     name: "default",     url: "{controller}/{action}",     defaults: new { controller = "login", action = "login" } ); 

and put @ bottom of routes off course.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -