Ignoring a route in ASP.NET MVC
I am just learning to work with routing in ASP.NET MVC and am trying to understand the IgnoreRoute method. I am trying to prevent users from accessing "Content/{filename}.html" . I have placed this as the first call in my RegisterRoutes method. Here is my code: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("Content/{filename}.html"); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("MyRoute", "{controller}/{action}/{id}/{*catchall}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new { controller = "^.*", action = "