1

I really would like to integrate ELMAH into my MVC4 application but I'm having a few issues:

  • if elmah redirects all errors to a specific error page, do I only need to return success (eg for update, delete, ...) to the user?

  • if elmah catches all errors do i need to handle errors (e.g. use try catchblocks) in my code at all?

  • is there a best practise example somewhere how to use ELMAH?

1 Answer 1

3

1) Elmah does do any redirects, so you have handle error pages yourself in web.config (hot ot do this you can look here)

2) You should. Elmah is for logging unhandled exceptions. You can log handled exceptions like this:

try
{
    .....
}
catch(Exception ex) 
{
     Elmah.ErrorSignal.FromCurrentContext().Raise(ex); 
}

3) There is a nice article is on Scott Hanselman blog: ELMAH: Error Logging Modules and Handlers for ASP.NET (and MVC too!)

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

1 Comment

Also consider using the excellent Elmah.MVC project - nuget.org/packages/Elmah.MVC for painless integration of Elmah with MVC.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.