Sometimes in your web part pages you may want to show the same "Access Denied" screen to the user that SharePoint provides by default when user has no access to any resource or page.
try
{
//your custom code
SPUtility.HandleAccessDenied(new Exception("not authorized"));
}
catch (Exception Ex)
{
}
This can be easily achieved by making use of SPUtility Class of sharepoint as:
try
{
//your custom code
SPUtility.HandleAccessDenied(new Exception("not authorized"));
}
catch (Exception Ex)
{
}
No comments:
Post a Comment