1

I don’t know it this is an issue with ELMAH or ASP.NET MVC3, or just the combination of the two: I’ve configured my MVC 3 website to use ELMAH, but when I enable my “pretty” error page in web.config, ELMAH stops logging exceptions. I used to have just this in my web.config,

<customErrors mode="On" defaultRedirect="/Error.htm" redirectMode="ResponseRewrite"></customErrors>

But at first I didn’t have an Error.cshtml view in my shared folder: ELMAH would log an exception for the missing Error view, when some other exception was thrown. After adding an Error.cshtml view, ELMAH doesn’t log any exceptions anymore.

I’m guessing I need to configure MVC to handle exceptions in a different way, so they’re picked up by ELMAH, and the ASP.NET eventually kicks in and displays the error .htm page. How do I do that? Or am using MVC exceptions and/or ELMAH wrong?

Jakob Gade
  • 12,319
  • 15
  • 70
  • 118

1 Answers1

2

Look at this answer directly from the author of Elmah. There is also another answer in the same thread that should give you an alternative approach

Community
  • 1
  • 1
Iridio
  • 9,213
  • 4
  • 49
  • 71
  • Thanks for the pointer. I used the second most popular answer, http://stackoverflow.com/questions/766610/how-to-get-elmah-to-work-with-asp-net-mvc-handleerror-attribute/5936867#5936867, which made a little more sense to me. :) – Jakob Gade Oct 27 '11 at 04:16