How to create Custom Error Page

Step by step procedure to create a custom error page for a web application

Locate and copy the error.aspx file in Layouts folder of the 14 Hive (%PROGRAM FILES%\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS). Never never never ever touch the system files…make copies and use those.

Create a new folder in the Layouts folder (ex. CustomError) and then paste the copied error.aspx file.

Locate the below code
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">

Change the content
<asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
            <span id="errorPageTitleSpan" tabindex="0"><img src="/_layouts/images/CompanyLogo.jpg"/><br/><br/> Some Error  </span>
    <p><a href="mailto:Helpdesk@yourcompany.com?subject=New SharePoint Incident&amp;body=&lt;Please provide a short description and paste Error including Correlation ID and Date Time here&gt;">Log SharePoint Support Ticket</a></p>
</asp:Content>

Find PlaceHolderMain and include the below script

<style>
.s4-simple-iconcont{            display:none;}
</style>

Find this line inside PlaceHolderMain <span class="ms-descriptiontext"> and remove the content inside this span

Open up your best friend, SharePoint 2010 Management Shell, and perform the following command:

Set-SPCustomLayoutsPage -Identity Error -RelativePath “/_layouts/CustomError/error.aspx” -WebApplication <webappURL>

Then perform an IISRESET. Next, do something to break SharePoint (how many time will you here that request?) and test out your error message.

At any point, you can set the error page back to the default by running the following command and then IISRESET:

Set-SPCustomLayoutsPage -Identity Error -WebApplication <webappURL> -Reset

Comments

Popular posts from this blog

Activating a SharePoint Feature on Multiple Sites or Site Collections using PowerShell

Managed Path with WildCard and Explicit Inclusion

List All SharePoint 2010 PowerShell Commands