How to use MVC style routing while still keeping static page URLs intact?
I have a web server that has existing pages in it that are created with basic static HTML. I want to leave them alone, but augment the site with some ASP.NET MVC pages. I want these pages to be reachable via the MVC URL routing mecha开发者_StackOverflownism. But, ideally, I want to preserve the old static pages URLs without having to bring all those static pages into the MVC app. What's the best way to accomplish this?
Static files such as .html pages that exist on disc will be directly served by the web server. If you are hosting your application in II7 integrated mode you could try adding the following route:
routes.IgnoreRoute("{file}.html");
By default routing is not applied when a physical file exists which could be turned off by using routes.RouteExistingFiles = true;
.
精彩评论