Make the most of your SharePoint 401, 403 and 404 Errors
404sp

Make the most of your SharePoint 401, 403 and 404 Errors

Posted by on Monday, September 23rd, 2013  

 

In my quest to bring more value for the SharePoint Power Users, here’s another tip that may not have people singing your praises, but they will at least have a good laugh or cry should some horrible thing happen within your SharePoint environment.

I recently ran across the page below when searching on Bigstock.com for some icons to add to an intranet site I was building for a demo.  To my surprise, after a few seconds of spinning, I was greeted by this cute little guy.  I quickly put in a new search and was back on my way sifting through for some icon to use.

SharePoint Error Messages

It took me a few minutes to realize what happened and thinking about things from a User Experience (UX) perspective, I was thoroughly impressed.  I was able to repeat that query and get the page again – which is how I got the screenshot.   This experience got me thinking about the intranet demo I was building and why I should probably do the same thing for my users.  Like most designers and administrators, I put in countless hours of testing and debugging to ensure that things are working, but I’m only human.  Since I do care a lot about the user’s experience and want to ensure they are having a good time while on my site, I should help them out any way I can.

Most often though, we don’t take into consideration the few times SharePoint may do something really out of the box, or someone may delete a file, remove a link, or who know what causes those “unknown errors.”  Yes, we can and should troubleshoot them whenever possible, but why not give the user a nice page should they stumble upon something that isn’t quite right.

SharePoint OOTB gives us some really cool error pages (sike!), see two examples below.

SharePoint Error Messages
SharePoint Error Messages
Those pages are so not helpful and gives your users all the ammo (uhmm, I mean perspective) they need to continue to hate the very existence of SharePoint and possibly the person who manages it which just might be you.  So do yourself and them a favor, replace those darn pages with something that shows your SharePoint site has class.

 

Tip of the Day – with Extras

The next time you have a few moments and want to do something to help your users do the following:

  1. Create a new page and call it “CustomError.html” or something you can identify and remember.
  2. Add a nice cat photo, or any photo for that matter that is cute or funny.  (Anything else may just tick off your user.)
  3. Add some text to bring joy to their find, and replace the standard page in SharePoint.

Here’s a custom page I created and uploaded in less than 10 minutes.

SharePoint Error Messages

How to edit your Custom Page:

  1. Determine if you have permissions to even perform this process
    1. Do you have access to the server running SharePoint?
    2. Can you access the following folder on your server?
\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033

SharePoint Error Messages

Note: 1033 is the language ID for English, so if you are running a different language you should identify that folder number and access the file there.

2. If you answered yes to both A & B, then you can proceed with step 3.  If not, skip to step to the next section for help.
3. Locate the file “sps404.html”.
4. Copy the file and rename the copy to CustomError.html
5.Open that file in an html editor of your choice, SharePoint Designer, NotePad++, Dreamweaver or whatever.
6. Change your CustomError.html file to be whatever you want it to be. (for me I simply loaded an email and made a hyperlink underneath it with a link back to the root site URL.
7. Open SharePoint Management Shell and type the following commands

$webapp = Get-SPWebApplication http://<Your Server Name Here>/
$webapp.FileNotFoundPage = "Custom404.html"
 $webapp.update()

SharePoint Error Messages

That should take care of it and you should be able to browse to SharePoint, produce an error in the pages and see your new custom page.

One caveat to note is that you may notice the following code inside your sps4040.html page.  That information is helpful in displaying the types of errors that may be occurring in SharePoint.  Though Unknown Error is popular, there are times when SharePoint will hand you a piece of code called a CorrelationID.  That is useful for finding the error inside your Error Logs on the server.  So while a picture is always nice, do think of a way to keep that information in your page so your users can still give you the right details to help you find out why SharePoint was so pesky in the first place.

<noscript>
   <meta http-equiv="refresh" content="0; url=/_layouts/spsredirect.aspx?noscript=1" />
  </noscript> 
  <script language="javascript" src="/_layouts/1033/init.js"></script>
  <script language="javascript" src="/_layouts/1033/core.js"></script>
  <script language="javascript">
   var requestedUrl = escapeProperly(window.location.href);
   STSNavigate("/_layouts/spsredirect.aspx?oldUrl=" + requestedUrl);
  </script>

 If you do not have access to your server, then do the following:

  1. Create a new html file using the html editor of your choice, SharePoint Designer, NotePad++, Dreamweaver or whatever.
  2. Add an image, text, links or whatever you want into that page.  Ensure your URL’s are relative if possible or hardcoded to the root site of the web app you are customizing the error page for.
  3. Now here’s the hard part
    1. Bake some cookies, grab a Starbucks gift card, or draft a really nice email
    2. Approach your IT people and plead with them to update the file for you
    3. Print or email this to them and ask them to ignore this part
    4. Oh yea, give them whatever you purchased or did in “A”.

For the KB article supporting all of this, click here: http://support.microsoft.com/kb/941329

 

Extras:

Told you I had extras. Below are some nice images that you can use for your own 404 pages or to just play pranks on people.  Happy 404ing in SharePoint, and check out the CamelCase I’m using here.  It’s imperative to file naming just as much as URLS.  Read my other blog for more info on CamelCases.

To download, right-click and select “save image as.”

SharePoint 404

SharePoint 404

SharePoint 404

 

Disclaimer
The sample scripts are not supported under any Summit 7 Systems standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Summit 7 Systems further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Summit 7 Systems, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Summit 7 Systems has been advised of the possibility of such damages.

Posted by on Monday, September 23rd, 2013  

Subscribe to RSS Feed

Sign Up for Newsletter