I am working on an ASP.NET MVC application. In this application, I need to dynamically generate a sitemap when it is requested. I know how to set up routes in general. However, I'm not sure if I can create a route for a specific file. I currently have the following in RouteConfig.cs:
routes.MapRoute(
name: "Sitemap",
url: "resources/sitemap.xml",
defaults: new { controller = "Site", action = "Sitemap" }
);
In my SiteController, I have the following:
public ActionResult Sitemap()
{
}
When I enter /resources/sitmap.xml in the address bar of the browser, I notice that my Sitemap () action never fires. Is it even possible in ASP.NET MVC to configure a route for a specific file? If so, how?
Thanks,
source
share