I want to display all errors on one page (without redirecting / changing the contents of the page) where this happened (for example, a javascript warning), and I think that the error page may load as a PartialView. I am trying to create a custom HandleErrorAttribute, but it does not work:
public class CustomHandleErrorAttribute : HandleErrorAttribute
{
public string PartialViewName { get; set; }
public override void OnException(ExceptionContext filterContext)
{
var result = new PartialViewResult();
result.ViewName = PartialViewName;
filterContext.Result = result;
}
}
source
share