ASP.Net MVC - Trapping certain URL's to do 301 Redirect

孤人 提交于 2019-12-01 14:57:14

That's right, just do it in your routes configuration (usually in global.asax). You can set these up as static special cases.

routes.MapRoute("Page3", 
            "SomeURL/Page3.html",
            new { 
                  controller = "SomeController",
                  action = "SomeAction",
                  page = "2"
                });

For PageXX.html, PageX.html, Index.html pages you can do regular expression based matching too. That will allow you to maintain the whole thing with a single route mapping.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!