Scenario:
You want to redirect user to access denied page when your code attempts to access an object to which the user does not have access.
Solution:
SPUtility class provides method HandleAccessDenied, which redirects user to standard access denied page.
Code Snippet:
try
{
//your code goes here
}
catch(Exception ex)
{
SPUtility.HandleAccessDenied(ex);
}
0 comments:
Post a Comment