This project is read-only.
Project Description
Current feature allows to specify the custom error page where the user will be redirected in case of 403 SharePoint Error

Intoduction
SharePoint 2007 controls how errors are handled using pages from "\_layout\" folder, and in case of "403 Forbidden" error user is redirected to "AccessDenied.aspx" page.

In some cases you need a custom, "user friendly" page for all error pages, like 401, 403, 404, 500 and etc.
Those pages can be handled via IIS ingoring the SharePoint handling, except the page 404 and 403 - they are handled by SharePoint differently.

To provide custom 404 error page please refer to this solution http://www.codeplex.com/sharepointsmart404
403 page can be customized by modifying "AccessDenied.aspx", but modifying OOTB pages is not a recommended approach.

How it works
To provide the desired behavior we developed the HTTPModule that controls the error codes and the url of the site to trigger the user redirection away from the "AccessDenied.aspx" page.

Current feature is scoped by "Wep Application" level and when activated it installs the following:
1) custom developed HTTPModule
2) new <appSettings> to web.config of the selected Web Application <add key="SPCustom403PageUrl" value="" />

When you activate the feature you need to modify the value of web.config to set the custom page url where the user will be redirected.


Installation

Download the latest WSP package and install the feature using the following script

"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe" -o addsolution -filename <fileName>
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe" -o deploysolution -name <fileName> -immediate
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm.exe" -o execadmsvcjobs

Activation

"SharePoint403PageFeature" is available for activation from the Central Administration.
Open Central Administration, navigate to "Application Management > Manage Web Application Features". In the top right corner select the Web Application you want the activate feature for.


Redirection

After feature is activated open the web.config of the current Web Site (C:\inetpub\wwwroot\wss\VirtualDirectories\<yourSite>\web.config", and navigate to the <appSettings> section where you need to modify the value of the <add key="SPCustom403PageUrl" value="" /> entry, setting the desired URL.

Contact Details

For all questions you can contact me via http://msmvps.com/blogs/laflour -> Contact Form

Last edited Jan 5, 2010 at 12:37 AM by laflour, version 8