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?

1
  • What if you try to handle errors in Application_Error in Global.asax.cs and log the errors to ELMAH there? Commented Oct 25, 2011 at 7:09

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the pointer. I used the second most popular answer, stackoverflow.com/questions/766610/…, which made a little more sense to me. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.