Asp.net mvc override OnException in base controller keeps propagating to Application_Error
The following should work:
protected override void OnException(ExceptionContext filterContext)
{
if (filterContext.ExceptionHandled)
{
return;
}
filterContext.Result = new ViewResult
{
ViewName = "~/Views/Shared/Error.aspx"
};
filterContext.ExceptionHandled = true;
}
Also make sure that no exception is thrown in this method or it will propagate to Application_Error
.