In this SharePoint customization tutorial, I will explain how to customize access denied page in SharePoint 2013/2016.
After customizing the entire site user want to redirect all the non-existed users to a different page with a custom access denied message. In this article, I would like to walk you through the approach to update/associate a web application with a custom access denied page. The default access denied page for SharePoint 2013 resides at \Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\ AccessDenied.aspx
If you are new to SharePoint online you can download SharePoint Online FREE PDF and HUB site PDF.
Please follow the below steps to change the default association:
1. Log on to SharePoint WFE environment with FARM admin account
2. Open the windows explorer and navigate to the layouts folder
\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS
3. Create a new folder called “UserCustomPages” under LAYOUTS folder
4. Copy the AccessDenied.aspx page to a newly created folder
5. Edit the access denied page with the custom message after “ms-accessDenied-reqDialog” tag as shown below
6. We can see in the below screen with default AccessDenied mapping and newly user created access denied page.
Note: You might have noticed that sharepoint associate the AccessDenied page as a relative path. The actual file resided in “\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\UserCustomPages” the relative path for the same is “/_layouts/15/UserCustomPages/UserCustomAccessDenied.aspx”
Set-SPCustomLayoutsPage -Identity “AccessDenied” -RelativePath “<< Custom relative path >>” -WebApplication “<<Web Application URL >>”
Set-SPCustomLayoutsPage -Identity “AccessDenied” -RelativePath “/_layouts/15/UserCustomPages/UserCustomAccessDenied.aspx” -WebApplication “http://sharepoint13:12345”
7. As soon as mapping completed login to SharePoint site with an unauthorized user and it will show the below new user access denied page.
You may like following SharePoint 2013 customization tutorial:
- Steps to add HTML Master Page to SharePoint 2013 or SharePoint online using Design Manager
- SharePoint 2013 Create and Customize Custom Left or Quick launch Navigation
- JSLink in SharePoint 2013 or JSLink in SharePoint Online
- How to customize search results look by using result types and display templates in SharePoint Online and SharePoint 2016/2013?
- Steps to show cascading dropdown in Nintex Forms for Office 365 SharePoint Online
- What is a Shared mailbox in Office 365? How to create and access SharePoint mailbox in Office 365?
- SharePoint Online Gantt Chart View for Task List
Hope this helps to customize access denied page in SharePoint 2013/2016, enjoy customization in SharePoint !!!
SharePoint Online FREE Training
JOIN a FREE SharePoint Video Course (3 Part Video Series)