I am having problems using the [HandleError] attribute on my Controller Actions - it doesn\'t seem to work at all (i.e. it doesn\'t matter if the filter is there or not - I
Two useful things to know:
By default, HandleError does nothing when running under the development server. The intention is to show developers more useful information:
public virtual void OnException(ExceptionContext filterContext) {
if (filterContext == null) {
throw new ArgumentNullException("filterContext");
}
// If custom errors are disabled, we need to let the normal ASP.NET
// exception handler execute so that the user can see useful
// debugging information.
if (filterContext.ExceptionHandled
|| ! filterContext.HttpContext.IsCustomErrorEnabled) {
return;
}
Note that this case is precisely what customError is supposed to control. If setting customError="On" does not change this behavior:
Web.config in the project root, not the one in Views.HttpContext.IsCustomErrorEnabled.Web.configSecond, there certain types of errors which HandleError will never handle, notably ASP.NET compilation errors. You don't say which error you're encountering.