Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

which is the best way to create a custom error page in sharepoint ?

share|improve this question
add comment

2 Answers 2

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 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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.