title: Redirect all requests to ASP.NET MVC on IIS6
body: <p>I am probably overlooking something really simple here but I am trying to redirect all bad URLs to an action that filters the URL based on conditions and then either 301 redirects to a suitable page or issues a 404 page.</p>
  
  <p>To this end I have a route like this at the end of my route table:</p>
  
  <pre><code>routes.MapRoute("Error", "{*url}", new { controller = "Main", action = "Error" }); 
  </code></pre>
  
  <p>And an action like this:</p>
  
  <pre><code>public ActionResult Error(string url)
  {
          if (/* Conditions are met... */)
          {
              Response.Status = "301 Moved Permanently";
              Response.AddHeader("Location", /* Destination URL */);
              Response.End();
          }
  
          Response.StatusCode = 404;
          return View(/* 404 page... */));
  }
  </code></pre>
  
  <p>This works perfectly locally.</p>
  
  <p>However, when deployed to IIS6, URLs that don't include .mvc (e.g. oldfile.php) are never sent to the ASP.NET process for routing.</p>
  
  <p>Is there a simple solution / am I overlooking something?</p>
  
  <p>EDIT :
  This is related to <a href="https://stackoverflow.com/questions/108813/404-http-error-handler-in-aspnet-mvc-rc-5">this question</a>, however under IIS6 URLs without .mvc are not being sent for ASP.NET MVC processing.</p>