SharePoint 2013 Hosting UK – How to Setiing Custom Access Denied Page Bug in SharePoint 2013 ?

There are several reasons that cause the requirement to have your own Custom Access Denied Page in SharePoint 2013, like dynamical the text of the message or adding a a lot of dynamic page / form to gather information from the user or perform another operate. Once you build your page and acquire it deployed to Layouts Folder and use below Powershell Commands

SharePoint-2013-Hosting

Or

Now, Let’s Check the set property with PowerShell command code:

You will observe the updated worth however after you strive browsing you may get the default AccessDenied Page however not the custom access denied page. this is often a notable bug in SharePoint 2013 product. until currently with the current release of CU1 in Feb 2014, this issue isn’t been fixed.

Inorder to accomplish this, you’ll go together with HttpHandler or HttpModule. Here we tend to most popular to go with HttpModule and below is the code snippet for it.

 Note:  The custom access denied page [aspx] should has to Inherit from  “Microsoft.SharePoint.ApplicationPages.AccessDeniedPage” class.
e.g. <%@PageLanguage=”C#”Inherits=”Microsoft.SharePoint.ApplicationPages.AccessDeniedPage”MasterPageFile=”~/_layouts/simple.master”%>

Finally, write your C# code inline in PlaceHolderMain in the .aspx page. (This is the drawback).