You should really do it in IIS.
But if you want to have total control over it (can't find a good reason though!), you can add a catch all route as your last route. Something like:
routes.MapRoute(
"Static",
"{*path}",
new { controller = "Home", action = "Static"});
Then add an action to your control to handle it:
public ActionResult Static(string path)
{
//path is everything you get after the /
//Use Server.MapPath to load it
//Add headers to response, etc
return File();
}
But this is really bad in my opinion. The most obvious thing is taking the path from the URL and map it to server. What happens if the path is /../../Windows/...
? Probably nothing, but I don't like it.