Thursday, January 15, 2009

Error pages in SharePoint

Note: Because this blog automatically formats any markup, I've added dashes (-) in all elements (<-P->).

It's not very often that a SharePoint admin or developer gets to see the same errors that end users see when using SharePoint. Although I'd imagine that when end users receive errors, it is logged somewhere but I haven't looked to see where that log file is. Instead, I made a simple change to the SharePoint error page requesting the users to send me a copy of the error.

First, in order to get a detailed error message, you need to make two changes to your web.config file, located in C:\Inetpub\wwwroot\wss\VirtualDirectories\80. Find <-SafeMode ... CallStack="false" ...-> and set the CallStack value to "true". Then scroll down to find <-customErrors mode="On"-/> and change the mode to "Off". (taken from Andrew Connell's blog). Now you will get detailed error pages with a stack trace to help you pinpoint where the error happened.

Now back to my custom error page. In the 12 Hive (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12), open TEMPLATE\LAYOUTS\error.aspx. I added the following markup (minus the dashes) in the "PlaceHolderMain" content control right before:

<-p-><-b->Unfortunately an error has occurred. Please copy this error and email it to <-a href="mailto:email@domain.com">email@domain.com<-/A->.<-/b-><-/P->

Now your error pages will look something like this:

No comments:

Post a Comment