Trying to understand the MVC pipeline here:
It seems that the order is like so:
When does the Controller.OnException run relative to the ExceptionFilterAttribute.OnException ?
It's probably documented somewhere, in the source at least, but I just ran this little experiment:
// in MyHandleErrorAttribute, globally configured
public override void OnException(ExceptionContext filterContext)
{
Debug.Print("HandleErrorAttribute.OnException 1");
base.OnException(filterContext);
Debug.Print("HandleErrorAttribute.OnException 2");
}
...
// in HomeController
protected override void OnException(ExceptionContext filterContext)
{
Debug.Print("Controller OnException 1");
base.OnException(filterContext);
Debug.Print("Controller OnException 2");
}
and the Output Window shows:
HandleErrorAttribute.OnException 1
HandleErrorAttribute.OnException 2
Controller OnException 1
Controller OnException 2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.