如何使自定义错误页在ASP.NETMVC 4中工作
<customErrors mode="On" defaultRedirect="~/Views/Shared/Error.cshtml"> <error statusCode="403" redirect="~/Views/Shared/UnauthorizedAccess.cshtml" /> <error statusCode="404" redirect="~/Views/Shared/FileNotFound.cshtml" /></customErrors>
HandleErrorAttribute
FilterConfig
public static void RegisterGlobalFilters(GlobalFilterCollection filters){ filters.Add(new CustomHandleErrorAttribute()); filters.Add(new AuthorizeAttribute());}
System.Web.Mvc.HandleErrorInfo
OnException
HandleErrorAttribute
守着星空守着你
慕森王
犯罪嫌疑人X