Using ELMAH with MVC 3

Whereas ELMAH used to work pretty much straight out of the box, with MVC 3, a change to the global.asax.cs template means that ELMAH won’t automatically catch all errors, since MVC 3 has some built in error handling when custom errors are enabled. To remove this and let ELMAH catch everything, make sure you’ve removed the following line from your global.asax.cs file:

public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
    filters.Add(new HandleErrorAttribute()); // remove at least this line
}

(Note: if you read this wondering what ELMAH is, go here to catch up)

Something to add?

This site uses Akismet to reduce spam. Learn how your comment data is processed.