Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The question title may not be correct.

I have worked in a very big ASP.NET web application (without using MVC), there I used a simple error handling strategy :

  1. Enclose every statement in try..catch block
  2. Have a error label on each page at the very top
  3. If any exception occurs then show the error description on the Error Label.

Now I am switching to a new project where MVC 3 framework is to be used, so I came across ELMAH. It is indeed a nice tool for error handling and logging. But as I read from many sites, it basically logs unhandled exceptions.

If I use the same strategy that every statement in try..catch block and then show the error message on the page at the top, then where does ELMAH sit, how will it log the exception? Which exception will it log if I am not putting a single statement outside try..catch block. So there is no scope for the unhandled exception.

share|improve this question
"Gotta catch them all" counts as error handling? – delnan Nov 9 '11 at 14:32
@delnan I think he means "We don't use debuggers, we use the textual output in a browser" – Raynos Nov 9 '11 at 14:57
up vote 1 down vote accepted

ELMAH is a module to be used with ASP.NET or ASP.NET/MVC.

I suggest always using it. It will log any unhandled exceptions - the ones you think you have handled, but haven't, or the ones where your normal logging fails.

You may believe there is no scope for unhandled exceptions - you are wrong.

share|improve this answer
So, do you suggest using ELMAH for handling unhandled exceptions and then using some log4net/nlog/Microsoft Logging Application block for normal logging/auditing purpose..? – Pravin Patil Nov 9 '11 at 10:29
@PravinPatil - ELMAH will log these exceptions, not handle them. For your own logging, you should indeed use any other logging library. – Oded Nov 9 '11 at 10:32
Thanks a lot Oded for your replies.... – Pravin Patil Nov 10 '11 at 6:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.