asp.net MVC - Default route doesn't appear to be working
I have setup some routes and they work so if i put localhost/MyWebApp/Reservas开发者_如何转开发 ...... it works.
I have setup up a default route that if somebody enter localhost/MyWebApp it should go directly to the Reservas route ... but it doesn't..
I have installed a route debugger and it appears nothing matches the request.. am i doing something wrong?
Can you help? ... here is my routes .. notice the last route is the DEFAULT route that i preusume should kick in and send me via the Reservas route
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Reservas", // Route name
"Reservas/{action}/{jsonData}", // URL with parameters
new {controller = "Reservation", action = "Index", jsonData="" } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"Reservas/{action}/{jsonData}", // URL with parameters
new { controller = "Reservation", action = "Index", jsonData = "" } // Parameter defaults
);
Your current default route will only match when the URL looks something like /MyWebApp/Reservas
. You should change it to look something like this:
routes.MapRoute(
"Default",
"{controller}/{action}/{jsonData}",
new { controller = "Reservation", action = "Index", jsonData = "" });
精彩评论