다음을 통해 공유


SPCustomLayoutsPage AccessDenied not showing the custom page

Symptom:

The custom AccessDenied page is showing the wrong page. Basicaly we were missing the request access link on our accessdenied page. First things to check is that the outgoing email settings are enabled and if the site settings allow the user to request access. All those things were set correctly, so it had to be something different (either bad coding or something else). As the custom layouts page was working properly (by going directly to the url _layouts/mycustompages/accessdenied.aspx) it had to be the mapping of the custom layouts page. This mapping in this project is done through a web application scoped feature, but you can check the mapping using Powershell (or modify the mapping).

To check if your custom layouts page is mapped correctly, use Get-SPCustomLayoutsPage (https://technet.microsoft.com/en-us/library/ff607821.aspx). The specific command I used was:

 $web = Get-SPWebApplication https://www.contoso.com
 
 Get-SPCustomLayoutsPage -Identity AccessDenied -WebApplication $web | Format-List

Strangely enough, this was showing that the AccessDenied page was mapped to _layouts/mycustompages/accessdenied.aspx which is correct. Just to make sure I reapplied the custom layoutspage through PowerShell by making use of Set-SPCustomLayoutsPage (https://technet.microsoft.com/en-us/library/ff607768.aspx) and the old page was still showing.

Cause and Solution:

The custom access denied page was being cached. After doing an IISRESET on every Web Frontend everything worked fine.

Comments

  • Anonymous
    May 20, 2014
    There is a Bug in SharePoint in setting up Custom Access Denied Page. To achieve this, please find the workaround in below URL Configure Custom Access Denied Page - BUG in SharePoint 2013 a2zdinesh.blogspot.in/.../configure-custom-access-denied-page-bug.html

  • Anonymous
    August 14, 2014
    Any ideas if the bug in SP2013 has been resolved? The resolution notes on a recent CU (May 2014: support.microsoft.com/default.aspx) indicates it has, but the problem persists after installing the CU (and even two CUs after that: we installed the July 2014 CU).

  • Anonymous
    January 27, 2015
    I have installed September 2014 CU But still problem persists. Anyone able to get fix for this issue ?