Issues combining ASP.NET MVC and ASP.NET Web Forms in the same application
Recently I started migrating an ASP.NET WebForms project to ASP.NET MVC. Hoping to do this in phases I created a combined project that is both a webforms project and an MVC project.
Routing allows some requests to go to the WebForms pages and some to go to the new MVC pages.
Routing has also enabled SEO friendly URLs for all pages.
Everything seemed to be working great until I added a form to an MVC page and the URL it decided to use for posting the results back was one of the ASPX pages instead of the page it should have been. The issue was that routes added for the legacy ASPX pages were being picked up as matches for the route that was being requested.
This article was helpful in explaining how to configure routes to avoid this problem http://forums.asp.net/t/1484855.aspx but I still had an issue with the root "/" Route which was being picked for every form I created. So I changed the root route to this and now all is well. Of course, changing the home page to an MVC Action would also have solved the issue but I'm not ready to flip it just yet.
Route("",
new RouteValueDictionary(new { Controller = "Dummy", Action = "Dummy" }),
new RouteValueDictionary(new { Controller = "Dummy", Action = "Dummy" }),
routeHandler);