The best solution I can find is not to mix MVC 3 with an existing web form site. Instead, set the MVC directory as your own starting point for the application, and then run MVC from this folder so that it and the existing webforms application do not completely know each other. Thus, the resource handler and httpmodules and other handlers still work on the website. And so the domain root goes to webforms default.aspx, not the default MVC. Also, I donβt need to insert this entry into global.asax, which in turn screwed up the mvc 3 URLs. The next problem was to figure out the urls so that I did not have url lke blog / blog / post /1. To fix this, I changed the html action link to
@Html.ActionLink(item.PostTitle, "Post", New With {.id = item.PostId}, Nothing)
And then make changes to global.asax - change the default route (just delete {controller}:
routes.MapRoute( _ "Default", _ "{action}/{id}", _ New With {.controller = "Blog", .action = "Index", .id = UrlParameter.Optional}, New String() {"RiderDesignMvcBlog.Core.Controllers"})
So now instead of blog / blog / index or blog / blog / post / 1, I get the correct clean URL without a duplicate blog in url - blog / post / 1
source share