SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Which is the best way to create a custom error page in SharePoint ?

share|improve this question
up vote 0 down vote accepted

Depends what you mean by "best". The easiest way: In your web.config file: in the <system.web> section, modify the customErrors element to:

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

share|improve this answer
i mean , i dont want standard sharepoint error page"page not found" page to come everytime . i need to have an error page designed seperately for my client and whenever there is any error the custom page shld be soming . – Nikhil Jangle Dec 28 '10 at 4:40
The 404 page not found situation is a little different. First you need to modify the FileNotFoundPage of the SPWebApplication object and give it a new file name, which you can code in a feature or do with Powershell. SharePoint looks for this 404 page in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033 (assuming English locale) - you can't give it a full path or URL. – SPDoctor Dec 28 '10 at 10:36

Write a HttpModule to handle the onerror event, and redirect to the custom error page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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