How can I re-direct the user to the standard SharePoint "access denied" page, similar to the image below?
Currently, I am throwing an UnauthorizedAccessException, but this error message is not as elegant as SP message.
throw new UnauthorizedAccessException("User does not have permission to access this list");
Any help will be highly appreciated.
You should be able to use SPUtility.HandleAccessDenied to do this. (You can pass in null for the exception parameter if you just want to force the Access Denied page to be displayed, but aren't actually handling an exception.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With