사용자가 페이지에 액세스 할 수 있는지 여부를 확인하기 위해 자체 권한을 사용하는 응용 프로그램이 있습니다. 액세스가 거부 된 경우 더 친숙한 "액세스 거부"페이지를 표시하려고합니다. Web.config의UnauthorizedAccessException() 클래스 오류
<customErrors mode="Off" defaultRedirect="~/ErrorPages/ErrorPage.aspx">
<error statusCode="403" redirect="AccessDeniedPage.aspx" />
</customErrors>I get the error below.
에서 MasterPage ...
if (!authorize)
{
throw new UnauthorizedAccessException(); //error occurs here, looks like I'm not allowed to use this class
}
에서 내가 그냥 단지 UnauthorizedAccessException()
클래스를 사용/인스턴스화하려고 노력의 결과로 오류가 나타납니다. 이 방법으로하고 싶습니다. 사용 방법이 있습니까?
/**************************************************************************************************************************
Attempted to perform an unauthorized operation.
Exception Details: System.UnauthorizedAccessException: Attempted to perform an unauthorized operation.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
*************************************************************************************************************************/