Simple ASP.NET MVC Routing question

Posted by Robert on Stack Overflow See other posts from Stack Overflow or by Robert
Published on 2010-05-26T17:50:14Z Indexed on 2010/05/26 17:51 UTC
Read the original article Hit count: 220

Hi there, I have two pages in my simple MVC App with two defined routes:

routes.MapRoute( "Results", // Route name "Results/{id}", // URL with parameters new { controller = "Results", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Main", action = "Index", id = UrlParameter.Optional } // Parameter defaults );

I needed to have the results page load with just a product ID such as this: [MyDomain....]/Results/12345. But also the main page does a POST (using JQuery) to the Results Controller for updates using this route: [MyDomain....]/Main/Update along with a data bag. This works fine when I only have the "Default" route. But when I added the other "Results" route, all the POST calls to update are failing. Any ideas what I'm doing wrong???

Thanks a lot.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc-routing