내 응용 프로그램에 대한 사용자 정의 오류 페이지를 만들려고하는데 대부분의 경우 작동하지만 403
오류는 아닙니다.ASP MVC 5 - 403 customError가 작동하지 않습니다.
내의 Web.config :
<customErrors mode="On" defaultRedirect="~/Error">
<error statusCode="404" redirect="~/Error/NotFound" />
<error statusCode="500" redirect="~Error/InternalServer" />
<error statusCode="403" redirect="~Error/Forbidden" />
</customErrors>
나는 이러한 요청을 위임하는 ErrorController
있습니다. 404
오류가 발생하면 사용자 정의 오류 페이지가 표시되지만 403
은 표시되지 않습니다. 기본 IIS 403 - Forbidden
페이지를 받고 있는데도 사용자 정의 오류 페이지를 설정했습니다. 나는 주변을 둘러보고 <httpErrors>
대신에 빈 페이지를 매번 제공하는 것처럼 보였습니다.
여기 내 Global.asax
가 도움이 있다면 :
void Application_Error(object sender, EventArgs e)
{
Exception exc = Server.GetLastError();
if (exc is HttpUnhandledException)
{
// Pass the error on to the error page.
Server.Transfer("ErrorPage.aspx?handler=Application_Error%20-%20Global.asax", true);
}
}