I have got a problem with my application in asp.net mvc 5. I try to create custom error views. I create it by sites: first site, second site
when application is running like local site, everything works fine, but when i deploy it on the server, custom error pages dont work.
In web config my code looks like:
<customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="~/ErrorPages/Error500.cshtml" >
<error statusCode="500" redirect="~/ErrorPages/Error500.cshtml"/>
<error statusCode="404" redirect="~/ErrorPages/Error404.cshtml"/>
</customErrors>
...
<httpErrors errorMode="Custom" existingResponse="Replace">
<remove statusCode="500"/>
<error statusCode="500" path="/ErrorPages/Error/Error500" responseMode="ExecuteURL"/>
<remove statusCode="404"/>
<error statusCode="404" path="/ErrorPages/Error/Error404" responseMode="ExecuteURL"/>
</httpErrors>
Error Controller:
public ActionResult Error500()
{
Response.StatusCode = 500;
return View();
}
public ActionResult Error404()
{
Response.StatusCode = 404;
return View();
}
and view:
@{
ViewBag.Title = "Error404";
}
Someone knows what is wrong?