I have an application that uses its own authorization to determine if a user has access to pages. I want to display a more friendly "access denied" page in the event that access denied. In the MasterPage...
if (!authorize)
{
throw new UnauthorizedAccessException();
}
In the web.config
<customErrors mode="Off" defaultRedirect="~/ErrorPages/ErrorPage.aspx">
<error statusCode="403" redirect="AccessDeniedPage.aspx" />
</customErrors>
I get the error below. To me it looks like I'm not allowed to, or the error is a result of just trying to instantiate the UnauthorizedAccessException() class,
Attempted to perform an unauthorized operation.
Exception Details: System.UnauthorizedAccessException: Attempt ...
Go to the complete details ...