SPSecurity.SuppressAccessDeniedRedirectInScope class
SharePoint 2013
Suppresses the automatic redirect when an UnauthorizedException is thrown within the using scope.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
When an UnauthorizedException is thrown, the default behavior of Microsoft SharePoint Foundation is to automatically redirect to accessDenied.aspx or return an HTTP 401 response, depending on whether the user is authenticated or not authenticated. This behavior may not be desirable in certain scenarios, for example, where the calling program should handle the UnauthorizedException.
Show: