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.

  • 1
    "Gotta catch them all" counts as error handling?
    – user7043
    Nov 9, 2011 at 14:32
  • @delnan I think he means "We don't use debuggers, we use the textual output in a browser"
    – Raynos
    Nov 9, 2011 at 14:57

1 Answer 1


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.

  • 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..? Nov 9, 2011 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, 2011 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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