title: How to redirect all invalid URLs to some action
body: <p>I have a Home controller with <code>Index()</code> and <code>Foo(int id)</code> actions and routings like these:</p>
  
  <pre><code>routes.MapRoute("Foo", "{id}", new { controller = "Home", action = "Foo" });
  
  routes.MapRoute(
      "Default", // Route name
      "{controller}/{action}/{id}", // URL with parameters
      new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
      );
  </code></pre>
  
  <p>So URLs like <code>/</code> and <code>/123</code> work as they are supposed to do. However when the URL is <code>/blahblah</code> where <code>blahblah</code> is not a valid action name I get the error</p>
  
  <blockquote>
    <p>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32'</p>
  </blockquote>
  
  <p>which is normal of course because the <code>Foo</code> action gets int parameter instead of int?</p>
  
  <p>The problem is I can't use int, because then both the <code>Index</code> and <code>Foo</code> actions match <code>/</code> URL, so there is additional unnecessary <code>Foo</code> call.</p>
  
  <p>So the question is, is it possible to catch the exception above OR redirect all not valid URLs like <code>/blahblah</code> to some other action.</p>