3

I have tried mapping a custom error page in SharePoint using both feature activation code and the PoSh cmdlet set-SPCustomLayoutsPage, but SharePoint does not want to use my page for some reason.

When I use the cmdlet get-SPCustomLayoutsPage I get the Error page relative path that I am expecting (ie my custom page: /_layouts/15/CustomError.aspx). I can manually navigate to the error page successfully too. But when I raise an error, the default error page is shown.

I followed this example for 2010, along with other similar posts, and this has apparently not changed. There are however a number of references to the new way of doing things for Publishing sites, but I am using a Team Site.

This is suppose to be a trivial task. Any guidance or input would be appreciated.

4 Answers 4

2

This is a known issue and will hopefully be fixed in a future hotfix. Here is a summary of (my findings)http://blog.randomdust.com/index.php/2013/07/custom-access-denied-page-in-sharepoint-2013/:

Although the same UpdateMappedPage method and Set-SPCustomLayoutsPage cmdlet exists in 2013, there is an identified bug in the product related to the property. The custom location can be set using either of these methods, but SharePoint will not recognize them and will continue to use the out of the box accessdenied.aspx page. I’ve verified this through a Microsoft internal distribution group as well as a support case submitted by me on behalf of one of my clients. Hopefully this gets fixed in a hotfix or CU, but until then you are out of luck.

There are a couple other options, though.

  1. Supported Option: Create an HTTP handler (covered a bit in this forum post) to intercept each request and redirect to your custom page if the server is sending the user to the out of the box accessdenied.aspx page. I don’t like this since it adds overhead to every SharePoint page request.

  2. Unsupported Option:

    • Add a delegate control to the error.master
    • Create a user control to be deployed to _controltemplates
    • Create an elements.xml file which will add the control to the delegatecontrol.
    • On the pageload method of the user control check the request url. If it is for access denied, redirect users to your custom page

A nice option for those who are ok with modifying out of the box pages.

Note: The problem has now been addressed by the April 2014 CU for SharePoint 2013.

1
  • 3
    This may be an answer to the question, but could you add some text of what your findings are here too? It would help future users not having to go to your blog, which may not be active in three years - or maybe been moved? Thank you!
    – Benny Skogberg
    Jul 4, 2013 at 6:33
2

This bug has been fixed in the April CU for SharePoint 2013. We confirmed that the mapping now works for both powershell and code. Hope that helps someone, sure helped us to have it repaired.

1

You can use SharePoint Designer 2013 and set ‘vti_filenotfoundpage’ property to your Custom error page deployed in 15 hive or /_layouts/15/CustomError.aspx.

See the options at my post below -

http://www.learningsharepoint.com/2013/06/17/replace-default-pagenotfounderror-aspx-with-custom-error-page-in-sharepoint-2013/

0
  1. Rename "your" custom error page to PageNotFoundError.aspx and delete the out-of-the-box
  2. Use the FileNotFoundUrl via Visual Studio. Get SPSite server relative Url or absolute URL to file not found page. This value is used as redirect URL for HTTP request where the resource cannot be found.

http://www.gknzcfc.net/subsite/how-to-modify-error-pages-on-sharepoint-2013.html

http://www.gknzcfc.net/subsite/custom-error-pages-on-sharepoint-2013.html

Hope this helps!

1
  • Thank you for responding Anuja. I don't want to replace the out-of-the-box files, as I don't want to affect other SP Web Applications that may not want a customized error page.
    – Grant Back
    Apr 10, 2013 at 0:56

Your Answer

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

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