a.m. wrote:BTW, do you experience it during development (in VS) or on a live site?
Okay, I have to add that we want to redirect links from our old shop that used classic asp with .asp extension in URL. So I added a IIS handler for that in web.config:
<remove name="ASPClassic" />
<add name="ASPClassicFileHandler" path="*.asp" verb="GET" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
Now if I try to request a URL like http://localhost/products/12345/myproduct.asp I configured a route for that and everything works (mapping old Id to new Id, getting slug and redirecting).
If I call a URL that does not match the route but ends with .asp (http://localhost/de/test.asp), it will redirect to 404 (CommonController, NotFound) as expected but the page will show html content instead of rendering it.
Maybe this is related with the TransferRequestHandler? Than it is no general bug. I fixed it by adding "this.Response.ContentType = "text/html; charset=utf-8";"
//page not found
public ActionResult PageNotFound()
{
this.Response.ContentType = "text/html; charset=utf-8";
this.Response.StatusCode = 404;
this.Response.TrySkipIisCustomErrors = true;
return View();
}