1

I'm new to SharePoint administration and have updated my custom error pages per this guide. It works just fine for the 404 page, but should this also cover all other SharePoint error pages (like say, a database error)?

Also, how can I simulate an error so that I can verify the proper custom error page is displayed? I'm attempting to close a security vulnerability identified on our SharePoint Foundation 2010 server so I need to be able to prove that whatever fix I implement is working before putting it into production.

Here are the steps from the link above for reference:

First create three pages and place them in this path

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\

Custom_Error.html

Custom_NotFound.html

Custom_AccessDenied.html

Note: if you have multilingual site you need to place these pages in their language folder for example for Arabic

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1025\

Second Open SharePoint 2010 Management Shell with Farm Administrator User

Now For Custom page Not Found runs the following Power Shell:

$webApp = Get-SPWebApplication http://test $webApp.FileNotFoundPage = “Custom_NotFound.html” $webApp.Update()

Run the following Power Shell:

$webApp = Get-SPWebApplication http://test $webApp.UpdateMappedPage([Microsoft.SharePoint.Administration.SPWebApplication+SPCustomPage]::Error,"/_layouts/1033/Custom_Error.html") $webApp.Update()

Edit: No one knows? I still haven't been able to find a solid answer through googling. :( Still no takers? I put a bounty on it...

1 Answer 1

2
+50

Below given solution covers all SharePoint error pages

To configure SharePoint Foundation server or SharePoint Server 2010 to point to a custom 404 error Web page, follow these steps.

  1. Log on to the computer that is running SharePoint Server 2010 by using an account that has administrative permissions.
  2. In Windows Explorer, locate the following folder:

This is the path for 14 hive

%systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID 

Notes

In this path, %systemdrive% represents the actual drive name of the drive on which the operating system is installed.

In this path, LangID represents the actual language ID of the language that you use. For example, 1033 is the language ID for U.S. English.

  1. Create the custom HTML file:

    On the computer that is running SharePoint Server 2010, copy the Sps404.html file to a temporary folder.

    Rename the Sps404.html file. For example, give the file the following name: Custom404.html

    Modify the Custom404.html file to suit your needs for a custom 404 error message using an HTML editor.

  2. Copy the Custom404.html file to the %systemdrive% \Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\LangID folder.

  3. Run the following PowerShell commands from the SharePoint 2010 Management Shell:

PowerShell Command

$webapp =Get-SPWebApplication http://<serverUrl>:<port>
$webapp.FileNotFoundPage = "Custom404.html"
$webapp.update()

Verify that the property is set by running the following command:

(Get-SPWebApplication http://<serverUrl>:<port>).FileNotFoundPage 

Notes

• In this code, represents the actual URL of the Web application where you are setting the custom 404 error page.

• In this code, represents the nonstandard port number, if any, that is assigned to the Web application.

• In this code, Custom404.html represents the actual name that you created for the custom HTML file.

For more information about how to use PowerShell scripts against SharePoint 2010, visit the following Microsoft Web site:

Windows PowerShell for SharePoint Foundation 2010

Note

By default in SharePoint Server 2010, the FileNotFoundPage property is set to the "null" setting.

To Simulate an error you can follow steps mentioned in below mentioned link. So that You can verify the proper custom error page is displaying or not

IIS Custom Error Page for common error

3
  • Great thanks. I'll award the bounty when it lets me. May 12, 2016 at 11:46
  • Happy to help you... :)
    – Hardik
    May 13, 2016 at 13:02
  • I've done this. it work with web sites and documents removed. But not with site collection removed ? have you any idea to have a custom page for a site collection removed ? thanks
    – Miguelafz
    Aug 30, 2018 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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