Monthly Archives: June 2012

How to Create a Custom Error Page on SharePoint

In a previous blog I explained how to Create a custom Page Not Found page on SharePoint 2010.  This is particularly useful for external facing publishing sites.

In this post I show how to add a custom error message for other types of error (4xx, 5xx).  Timeout, Bad Request etc.

  1. Firstly create your custom error page as you would create a normal page, e.g. “/Pages/ErrorPage.aspx”  Create one page for all errors or ones specific to each area you want a custom error message for.  You may want to remove these pages from the search results and navigation.
  2. Log on to your SharePoint server and naviagate to the web.config for the web application (and take a backup then) open in textpad or other editor
  3. Find the customErrors section and update as following…

If you have one page for all the errors update to

<customErrors mode="On" defaultRedirect="/Pages/ErrorPage.aspx"/>

If you create various pages for the different errors then you will need to use something like this

<customErrors mode="On" defaultRedirect="/Pages/ErrorPage.aspx">
<error statusCode="400" redirect="/Pages/Error400.aspx" />
<error statusCode="401" redirect="/Pages/Error401.aspx" />
<error statusCode="500" redirect="/Pages/Error500.aspx" />
</customErrors>

LASTLY – do an iisreset