Gets a value indicating whether custom errors are enabled for the current HTTP request.
protected override void OnException(ExceptionContext filterContext)
{
WriteLog(Settings.LogErrorFile, filterContext.Exception.ToString());
//custom error page
if (filterContext.HttpContext.IsCustomErrorEnabled)
{
filterContext.ExceptionHandled = true;
this.View("Error").ExecuteResult(this.ControllerContext);
}
}
This flag is controlled by the customErrors section in web.config. If the customErrors element’s mode attribute is set to On, IsCustomErrorEnabled returns True. If the CustomErrors element’s mode attribute is set to False or RemoteOnly, this flag is set to false.
Technorati Tags: MVC,Custom Errors
No comments:
Post a Comment