I've create a very simple mvc4 application(visual studio's default internet application). This is my RouteConfig class:
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.RouteExistingFiles = true;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("anyRoute", "content/themes/staticcontent.html", new { controller = "Account", action = "Register" });
routes.IgnoreRoute("content/themes/{filename}.html");
}
}
When the url mySite.com/content/themes/staticcontent.html is entered I want the user to be redirected to mySite.com/Account/Register but I access the mentioned file.
Also I want to restrict users from accessing any html file at the mentioned directory except staticcontent.html but I can access that file too.