This was solution to just hide the "Request Access" link on access denied page. But my requirement was to add the help desk information with Phone number and email address for which I had to create a new "Access Denied" page.
Following are the steps to do the same.
- Login to your WFE server, go to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS
- Create a folder called "CustomPages". [Note this is important because modifying the 14/15/16 hive is not recommended as the changes will be overridden when there is patching from Microsoft]
- Copy the AccessDenied.aspx page from the step 1 to "CustomPages" folder and rename it to "CustomAccessDenied".
- Open the CustomAccessDenied in notepad, Just above the <asp:HyperLink id="HLinkLoginAsAnother" ... add the line below
- Save the file.
- Now open the PowerShell Management Shell and type the command below
This shows the path for all the CustomLayoutPages like Access Denied, Error Page etc which will be blank as it will be default paths
- To tell the SharePoint to use your new AccessDenied, run the following command
- Execute Get-SPCutomLayoutsPage as below to see the effect
NOTE:
1. If you have multiple WFE, create the CustomPages folder and copy the file to other WFE servers as well
2. You don't have to run the command again in other WFE, but I have seen that you have to do an iisreset in other WFE(s) to tell the SharePoint to pick the new file.