Sharepoint 2010 – Custom Error Pages

Unless you love the default Sharepoint error pages for 404 (not found) and 401 (access denied), it is usually a good idea to change them. The steps are a bit different than a standard ASP.net application.

1) Browse to C:inetpubcusterr

2) You should now see a list of localization folders like en-US or fr-FR. Open the folder you want to edit and modify the error pages for 401,403,404 and 500.

3) Now browse to C:inetpubwwwrootwssVirtualDirectories and open the folder associated to the Sharepoint site you would like to affect.

4) Edit the file web.config and find the keyword customErrors. Replace the complete customErrors code block with:

<customErrors defaultRedirect="404.htm" mode="On">
	   <error redirect="401.htm" statusCode="401" />
	   <error redirect="403.htm" statusCode="403" />
	   <error redirect="404.htm" statusCode="404" />
	   <error redirect="500.htm" statusCode="500" />
</customErrors>

5) Now find the keyword <system.webServer>. Inside this block, place the following block code. (If the httpErrors block already exists, replace it completely!)

<httpErrors errorMode="Custom" existingResponse="Auto">
</httpErrors>

6) Save web.config and do the usual iisreset command if needed.

  • sarita

    Hi,
    I have developed aspx pages using VS 2010 and deployed to sharepoint.One of my page contains Gridview.When I am trying to view the record I am getting 404 page not found error I have checked with codethere is no issue in code how to solve this.The page for viewwing pages is there in site pages but still I am getting this error

  • Daniel

    Hi

    Excellent and timely post.
    I have made the following changes to the web.config sitting on my (:443) test web app site.
    Note my pages sit in C:inetpubcusterren-US

    I have a test user whose account was locked before I made the above change.
    In IIS when after 3 attempts to logon, I get
    “You do not have permission to view this directory or page.”

    When I looking in the IIS log I am getting the 401.1 errors but they are not being trapped. Do you have any advice please

  • Thomas

    I’ve set up everything according to you specifications, but all I get is the default 401 error page. I can modify it and the changes are reflected, but when I set

    even though the page is there right next to the 401.htm it does not redirect. Do you have any tips on what may be occurring?

  • Willy

    I followed Microsoft’s instructions at http://support.microsoft.com/kb/941329 (“How to point to a custom 404 error Web page in SharePoint”) and got negative results. My environment’s factors:

    * A single public SP 2010 server.

    * This server has a Web application hosting host-named site collections.

    * I wish to apply the custom 404 page to one of the site collections.

    I even applied the steps in kb941329 to our SP 2010 development server, specifically, to a Web application not hosting host-named site collections and got negative results.

    I don’t want to apply the steps here to the Web application hosting host-named site collections because they involve modifying the web.config, which would impact the whole Web application and, consequently, all the host-named site collections in it.

    Anyone ever get this properly working as per kb941329?

  • Waseem Khan

    That’s work perfect for me, thanks for helping me out.

    Regards,
    Waseem Khan