Changing SharePoint 2010 Access Denied Page

piemckay
piemckay used Ask the Experts™
on
I'm looking at the best method for changing the Access Denied (and possibly other error message screens)  for SharePoint 2010.
I've done some reading up and many have talked about changing the _layout/AccessDenied.aspx however being a novice at SharePoint I am unable to locate such file, furthermore many have mentioned its not recommended to change this file. I am wondering then whether its possible to insert maybe JavaScript to catch the error and redirect it to my custom page.

Here is the issue I am having it shows a iframe that is on an open page however the sharepoint calendar is locked down, but I dont want the access denied page to be shown to unauthorised users.

access denied
Any help will be great :)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Awarded 2012
Commented:
Hi,
you are right. You should never ever update any of the standard pages in the layouts folder (which is in %program files%/common files/microsoft shared/web server extensions/14)
because they will be updated in Service Packs and cumulative updates.
Instead, create your own pages, create a feature to deploy them and in the feature activation use the something like
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
if (webApp != null)
{
  if (!webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, YOURERRORPAGE)
...

Open in new window

More info about which pages in the SPCustomPage
 enumeration could be changed:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spwebapplication.spcustompage.aspx

Have a look into this excellent Wrox book - the relevant pages can be viewed on Google Books:
http://books.google.de/books?id=pjKoH3kIidoC&lpg=PT216&ots=v7AFeE7xr_&dq=UpdateMappedPage&hl=de&pg=PT215#v=onepage&q=UpdateMappedPage&f=false

HTH
Rainer

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial