none
How to Customize the "Sorry, this site hasn't been shared with you"

    Question

  • I am trying to customize this particular page but don't know the name of the page.  Assuming that it was the old SharePoint 2010 AccessDenied.aspx page, I modified the existing AccessDenied.aspx that I found in Template/Layouts and then used the web application method UpdateMappedPage to map the new page.  However, I did not see any change to the "sorry" page afterwards, so, I must be missing something.  Does anyone happen to know what these page file names are and where they're located?

    Monday, June 08, 2015 11:49 PM

Answers

  • I was able to implement a solution. Previously, in SharePoint 2010, when modifying the Access Denied page via PowerShell, I used the web application's UpdateMappedPage method. This didn't work when I used it in 2013. Instead, I discovered a new method, using the Set-SPCustomLayoutsPage command. I've written up the new approach in this technet wiki article: SharePoint 2013: how to create a custom access denied page.
    • Marked as answer by Stephan Bren Wednesday, June 10, 2015 8:15 PM
    • Edited by Stephan Bren Wednesday, June 10, 2015 8:15 PM
    Wednesday, June 10, 2015 8:15 PM

All replies

  • Hi Stephan,

    The file (accessdenied.aspx) you are looking is the right one (in 15 hive for SharePoint 2013). You can make a copy of this pages and customize it with a different message and UI. then by using the UpdateMappedPage method, you can sert the custom access denied page for a web application.

    Unfortunately, this is not working with SharePoint 2013 untill you install the April CU. After installing April CU, you can change the default access denied page to a custom one.


    Ram Prasad Meenavalli | MCITP | MCTS SharePoint | MCPD SharePoint | http://www.spdeveloper.co.in

    Tuesday, June 09, 2015 3:20 AM
  • This is a bug in SharePoint and  will not recognize your new page and will continue to use the out of the box accessdenied.aspx page.

    But you can

    1) use HTTP handler to intercept each request and redirect if the server is sending the user to the out of the box accessdenied.aspx page.

    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/5c40d604-bdb4-405a-88d6-a0d3b4eb0af1/how-to-set-custom-access-denied-pages-in-sharepoint-2013

    2)

    1. Add a delegate control to the error.master like below. 

    <SharePoint:DelegateControl runat=”server” ControlId=”MyDelegate” AllowMultipleControls=”true” />


    2. Create a user control to be deployed to _controltemplates

    3. Create an elements.xml file which will add the control to the delegatecontrol.

    <ControlId=”MyDelegate”ControlSrc=”~/_controltemplates/15/mycontrols/redirect.ascx”Sequence=”1″ />


    On the pageload method of the user control check the request url. If it is for access denied, redirect users to your custom page


    Amit Kotha

    Tuesday, June 09, 2015 6:34 AM
  • I was able to implement a solution. Previously, in SharePoint 2010, when modifying the Access Denied page via PowerShell, I used the web application's UpdateMappedPage method. This didn't work when I used it in 2013. Instead, I discovered a new method, using the Set-SPCustomLayoutsPage command. I've written up the new approach in this technet wiki article: SharePoint 2013: how to create a custom access denied page.
    • Marked as answer by Stephan Bren Wednesday, June 10, 2015 8:15 PM
    • Edited by Stephan Bren Wednesday, June 10, 2015 8:15 PM
    Wednesday, June 10, 2015 8:15 PM
  • follow that link, it works :)
    Monday, July 06, 2015 8:26 PM