views:

80

answers:

3

I'm using the filter from MvcContrib which causes nice error pages, my own views, to be shown when an error occurs. The problem is that when that happens, ELMAH doesn't send me an email about the problem and I still would like to know that something went wrong.

It seems the key is in ExceptionContext's exceptionHandled. When set to true, ELMAH doesn't send the email and I get my own view, if I set it to false ELMAH does send the message but I get an ugly message from IIS. Any ideas how to show the nice view and get the email?

+2  A: 

You need to add an intercept handler, like the one Scott Hanselman wrote about. I've named mine HandleErrorWithElmahAttribute. This gets called. Logs the error with ELMAH. Cleans everything up, and gives a nice page. You just have to make sure that your ELMAH action filter error handler gets an Order less than your MvcContrib error action filter.

Jarrett Meyer
A: 

Atlthough not related to ELMAH, you may want to take a look at this blog post on global exception handling in ASP.NET MVC.

Mark Seemann