title: Ignoring a route in ASP.NET MVC
body: <p>I am just learning to work with routing in <a href="http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework" rel="noreferrer">ASP.NET MVC</a> and am trying to understand the IgnoreRoute method.</p>
  
  <p>I am trying to prevent users from accessing <code>"Content/{filename}.html"</code>. I have placed this as the first call in my RegisterRoutes method. Here is my code:</p>
  
  <pre><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 = "^Index$|^About$" },
                      new[] { "UrlsAndRoutes.AditionalControllers" });
      routes.MapRoute("MyRoute2", "{controller}/{action}/{id}/{*catchall}",
                     new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                      new { controller = "^.*", action = "^Index$|^About$" },
                     new[] { "UrlsAndRoutes.Controllers" });
      routes.MapRoute("ShopSchema2", "Shop/OldAction", new { controller = "Home", action = "Index" });
      routes.MapRoute("ShopSchema", "Shop/{action}", new { controller = "Home" });
      routes.MapRoute("", "X{controller}/{action}");
  
      routes.MapRoute(
         name: "",
         url: "{controller}/{action}",
         defaults: new { controller = "Home", action = "Index" }
     );
  }
  </code></pre>
  
  <p>If I try to access a link like localhost:53907/Content/Static.html, it should not allow me to display the file from what I understand so far, but it does display it.</p>
  
  <p>What am I doing wrong?</p>