I have a custom HandleError
attribute that deals with errors on the MVC pipeline; I have an protected void Application_Error(object sender, EventArgs e)
Application_Error
might be the recommended way of handling errors in ASP.NET WebForms. But not in MVC.
We got error filters that take care of errors for us. The problem with the filter is that it only works when a controller has been invoked. Which is the problem for 404 and 401 errors (not found and authorization) and your database connection problem.
customErrors
is the way to go here. I don't see why the redirect should be a problem?
I'm going through proper error handling in a blog article: http://blog.gauffin.org/2011/11/how-to-handle-errors-in-asp-net-mvc/