I am trying to change the access denied page to add our help desk information and remove "Request access" link. Adding a "p" tag will work but when I try to remove/comment out the line for the asp link for "Request access" it throws me an error. What am I doing wrong? By the way I am editing in notepad directly on the WFE server.

<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.AccessDeniedPage" MasterPageFile="~/_layouts/simple.master" %> <%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> " EncodeMethod='HtmlEncode'/> " EncodeMethod='HtmlEncode'/> " EncodeMethod='HtmlEncode'/> " EncodeMethod='HtmlEncode'/>    

To request access please contact the help desk xxx-xxx-xxxx

    <asp:HyperLink id="HLinkLoginAsAnother" Text="<%$SPHtmlEncodedResources:wss,accessDenied_logInAsAnotherOne%>"
        CssClass="ms-descriptiontext" runat="server"/>
    <asp:HyperLink id="HLinkRequestAccess" Text="<%$SPHtmlEncodedResources:wss,accessDenied_requestAccess%>"
        CssClass="ms-descriptiontext" runat="server"/>

2 Answers 2


What if you just disable access requests?

enter image description here

enter image description here

  • You mean comment out?? I am sorry..I cannot see the images you attached above
    – user57156
    Sep 11, 2017 at 21:02
  • No, I mean this. Go you "Site settings" --> "Site permissions" ---> In the ribbon go to "Permissions" tab --> "Access Request Settings" ---> un-check"Allow access request" Sep 11, 2017 at 21:04
  • Yes that works for "Request Access". The thing is I want to remove "Sign in as a different User" as well.
    – user57156
    Sep 11, 2017 at 21:08
  • 2
    Never change any file in the 14/15/16 hive. Your changes will likely be lost on a patch. Use master page modifications instead.
    – user6024
    Sep 11, 2017 at 21:17
  • Agree with Trevor. Don't modify the OOB files, you can copy Access denied file to a different location and remove markup you don't want. Then check out my answer how to apply the new custom page. Sep 11, 2017 at 21:21

For SharePoint 2010, this is the way to create your custom page. Quick and dirty way:

  • Go to 14 hive folder and create a folder "CustomPages"
  • Put your custom .aspx or HTML file there. For example, call it Custom_Access_Denied.aspx
  • Run PowerShell command:

    $webApp = Get-SPWebApplication http://yoursite $webApp.UpdateMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::AccessDenied,"/_layouts/CustomPages/Custom_Access_Denied.aspx") $webApp.Update()

More info here


Proper way would be:

  • Create a custom WSP solution
  • Add your custom AccessDenied.aspx page to the solution
  • Create a Feature and with Feature receivers that apply a custom page and revert it back to the OOB one when feature is deactivated.

Update 2:

The reason you cannot remove ASP.NET controls from the ASPX file is that somewhere in in code behind, in OOB SharePoint DLL, these controls are referenced. I strongly advice against modifying this file, but if you still want to do it - just wrap the controls you want to hide in a div :

<div style='display:none'>
  <asp:HyperLink id="HLinkLoginAsAnother"...
  • Thank you for the detailed steps. I had followed the same steps as above except the powershell command was as below. Set-SPCustomLayoutsPage -Identity "AccessDenied" -RelativePath "/_layouts/15/custompages/AccessDeniedNew.aspx" -WebApplication "http:/mywebapplication/"
    – user57156
    Sep 12, 2017 at 14:55
  • Ah... I see what you mean.. I've updated the answer. Sep 12, 2017 at 15:03
  • Your explanation makes sense. Will try doing that. Thank you so much
    – user57156
    Sep 12, 2017 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.