I have implemented custom 404 page in my ASP. NET MVC 5 application, at first I have tested it on my localhost, and it worked perfectly. But when I moved my settings to release config, and tried to test it in production, the custom 404 page was gone, there was default mvc error page. What did I do wrong?
Web.config
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="404" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/Index" />
</httpErrors>
</system.webServer>
Controller
public class ErrorController : BaseController
{
public ActionResult Index(string id)
{
ViewModel vm = new ViewModel();
Response.StatusCode = 404;
return View("~/Views/..../Index.cshtml", vm);
}
}