开发者

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;.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜