I hav asp.net mvc 3 application.
When user pass id of non existing object I return 404 view in this way:
Response.StatusCode = 404;
return View("404");
Locally all works fine and I have my custom error page. But on production, I have standart asp.net 404 page. I try to set customErrors either to “on” or “off” – results is the same.
Found solution here: Routing for custom ASP.NET MVC 404 Error page
Set another magic setting in web config under system.webServer section: