Search This Blog

Tuesday, 18 December 2012

Sharepoint 2010 Redirect to Access Denied Page

Hi All,

If you want to redirect unauthorized user(s) to error page or access denied page, where they are going to deal with the page, without having proper permission. Instead of building new page(s), we can simply redirect them to access denied page.

you can use SPUtility.HandleAccessDenied() function.

Here is an example:

SPUtility.HandleAccessDenied(new Exception(“You don’t have access rights to see this content”));

Hope this simple tips helps you.

1 comment:

  1. Very usefull tip.
    But, I am not getting the custom error message passed with Exception constructor.

    Any suggestion please

    ReplyDelete