HandleError attribute on a controller detects an unhandled exception and redirects to the Error view, I would like to provide the user with a brief description of the error, and an option to email the error to the application administrator.
I do have a custom
HandleError that notifies Elmah to log the error, but having to look up the error in the Elmah log seems a bit of a last resort. Is there any other way to access the unhandled exception that is 'caught' by
HandleErrorAttribute supplies a Model object of type
Your Error page could look like this
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<HandleErrorInfo>" %>
The Model has an
Exception property with the details of the exception handled.
I usually use a custom error handler that also logs the exception using log4net and I have an STMP appender that emails me whenever an exception is handled by the filter.