I'm logging all errors occuring in my OnException method.
How to find in which controller/action an error occurred?
As Charlino implied, the values are available from the ExceptionContext parameter:
protected override void OnException(ExceptionContext filterContext) { var controllerName = filterContext.RouteData.Values["controller"]; var actionName = filterContext.RouteData.Values["action"]; // ... base.OnException(filterContext); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With