Monday, 11 April 2011

AccessDenied Exception and redirecting to sharepoint access denied page

some times we write the code for the user who are not authorized to access the information then sharepoint default security apply then shareoint through the access denied error.
You can catch and redirect the error to default access denied page.


Use the follwoing code to do same:

try
{
//Code to be executed
}
catch(Exception ex)
{
SPUtility.HandleAccessDenied(ex);
}