Error page is not getting displayed. Below is my configuration.
[HttpGet]
public ActionResult Index(string name)
{
throw new ArithmeticException();
}
//Handle Error attribute
public override void OnException(ExceptionContext filterContext)
{
//logging
filterContext.ExceptionHandled = true;
base.OnException(filterContext);
}
<customErrors mode="On" defaultRedirect="~/Error">
<error statusCode="404" redirect="~/Error/NotFound"/>
</customErrors>
I have placed “error” and “Notfound” views in “Error” folder. However, “Notfound” view is getting displayed if I type in invalid url. But for the arithmetic exception, default error page is not getting displayed, only blank page is displayed with same url. Could you anyone please suggest.
I’m not sure but, if you set
filterContext.ExceptionHandled = true;then errorhandler will not redirect you to error page. So try remove it.