title: MVC Handle 404s and set default error page
body: <p>I'm tying to enable the default routing in MVC.</p>
  
  <p>I want every 404 request to redirect to DefaultController DefaultRout()</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/310580/how-can-i-make-a-catch-all-route-to-handle-404-page-not-found-queries-for-asp-n">How can i make a catch all route to handle &#39;404 page not found&#39; queries for ASP.NET MVC?</a></p>
  
  <p>But {*url} dosen't work i'm getting 404 and not redirecting to the default page.</p>
  
  <p>My code:</p>
  
  <pre><code>public static void RegisterRoutes(RouteCollection routes)
  {
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
    routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
    routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
    routes.IgnoreRoute("{resource}.gif/{*pathInfo}");
  
    //http://localhost:4775/BW/A/Tasks
    routes.MapRoute("Pages", "A/{controller}", new { controller = "Tasks", action = "InitPage" });
  
    routes.MapRoute(
      "404-PageNotFound",
      "{*url}",
      new { controller = "Default", action = "DefaultRout" }
    );
  }
  </code></pre>
  
  <p>What am I missing?</p>
  
  <p>Thanks </p>
  
  <p>Rafael</p>