views:

37

answers:

0

In using the global error handler technique described here,

http://stackoverflow.com/questions/1171035/asp-net-mvc-custom-error-handling-application-error-global-asax

I want to log what area/controller/action was in effect when this error occurred. However, when putting a line in Application_Error such as:

var controller = ViewContext.RouteData.Values["controller"];

The compiler complains that RouteData cannot be used in a static context. Is there another technique that would allow the last area/controller/action to be determined?