Hi,
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.
To this end I have a route like this at the end of my route table:
routes.MapRoute("Error", "{*url}", new { controller = "Main", action = "Error" });
And an action like this:
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... */));
}
This works perfectly locally.
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.
Is there a simple solution / am I overlooking something?
EDIT : This is related to this question, however under IIS6 URLs without .mvc are not being sent for ASP.NET MVC processing.