Kwizcom Forms

Customize access denied page in SharePoint 2013

customize access denied page sharepoint 2013

In this SharePoint customization tutorial,  I will explain how to customize access denied page in SharePoint 2013/2016.

Objective:
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

SharePoint deveopment training course

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

customize access denied page sharepoint 2013
customize access denied page sharepoint 2013
customize access denied page sharepoint 2016
customize access denied page sharepoint 2016

5. Edit the access denied page with the custom message after “ms-accessDenied-reqDialog” tag as shown below

customize access denied page sharepoint 2016
customize access denied page sharepoint 2016

6. We can see in the below screen with default AccessDenied mapping and newly user created access denied page.

create custom access denied page sharepoint 2013
create custom access denied page sharepoint 2013

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”

PowerShell Command:

Syntax:
Set-SPCustomLayoutsPage -Identity “AccessDenied” -RelativePath “<< Custom relative path >>” -WebApplication “<<Web Application URL >>”

Example:
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.

sharepoint online custom access denied page
SharePoint online custom access denied page

You may like following SharePoint 2013 customization tutorial:

Hope this helps to customize access denied page in SharePoint 2013/2016, enjoy customization in SharePoint !!!

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Krishna Vandanapu

I am Krishna.Vandanapu a SharePoint architect working in IT from last 13+ years, I worked in SharePoint 2007, 2010, 2013, 2016 and Office 365. I have extensive hands on experience in customizing SharePoint sites from end to end. Expertise in SharePoint migration tools like Sharegate, Doc Ave and Metalogix. Migrated SharePoint sites from SharePoint 2007 to 2010 and 2010 to 2013 several times seamlessly. Implementing CSOM with Microsoft best practices. Spent quality time in configuring SharePoint application services like User Profile, Search, Managed Meta data services etc. Now exploring SharePoint Framework and SharePoint 2019

View all posts by Krishna Vandanapu →