C# mvc3 redirect sitemap.xml to controller action

我怕爱的太早我们不能终老 提交于 2019-12-08 03:41:27

You can use MVC's routing feature to achieve this:

routes.MapRoute(
    "Sitemap",
    "sitemap.xml",
    new { controller = "Home", action = "Sitemap" } 
);

With this placed placed in your global.asax file, all requests to domain.com/sitemap.xml will be routed to the Home controller's Sitemap action.

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