Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find in which controller/action an error occurred?

Tags:

I'm logging all errors occuring in my OnException method.

How to find in which controller/action an error occurred?

like image 420
Alex Avatar asked May 05 '10 02:05

Alex


1 Answers

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); } 
like image 134
OdeToCode Avatar answered Oct 28 '22 11:10

OdeToCode