How to handle downtime by sending all requests to one HTML page 6

I had a nice little Sunday planned today, but it was interrupted by the SharePoint911 uptime monitors telling me that our web server had pooped itself (technical term… trust me). Shane did some poking around and found that the hard drive had died… we have backups but bringing it back online is going to take a bit (our clients always come first!). We decided to temporarily put up a maintenance page until we can bring the site back completely. I had to do some GoogleBing’ing to find a simple way to funnel all of the web links that point to our various pages and blogs to one page telling people we are working on the problem.

Turns out the solution is actually pretty simple. Any ASP.NET 2 app (including SharePoint) can funnel all web traffic to one HTML page just by placing a file named app_offline.htm into the IIS web root. Here is more information on the technique:

Taking an ASP.NET 2.0 Application Offline

I did run into two gotcha’s:

  1. Make sure the file is over 512 bytes – Not sure why, but IIS thinks the file couldn’t possibly convey any useful information if its under that size and doesn’t use it.
  2. Loading images on the page can be challenging, they need to come from another web app or server or you need to do a lot of extra work to encode them. I didn’t bother with this method but you can search for it on the web if you want… I just hosted the images from our public Dropbox folder.

6 thoughts on “How to handle downtime by sending all requests to one HTML page

  1. Reply Brian H Jan 16, 2012 1:57 pm

    AWS S3 is a great place to stage images, too.

  2. Reply Anonymous Jan 16, 2012 6:08 pm

    Hello Randy,

    This trick comes in handy. Thank you very much.

    -hn

  3. Reply Servé Hermans Jan 17, 2012 9:41 am

    I have also seen that Newsgator is using the same technique for Central Admin to show you a page telling you that Newsgator is being installed. In our case the installation went wrong and although everything was deinstalled, the message remained. It took a while before I realized that this page was sitting there in the web folder. :-)

  4. Reply Anonymous Jan 18, 2012 9:18 pm

    Great tip, Randy.

    tk

  5. Reply Sharepoint 2010 Jan 30, 2012 12:59 am

    Thanks for sharing valuable information regarding ASP.NET 2.0 applications. Keep up the good job.

  6. Reply Tyler Holmes Feb 29, 2012 3:40 pm

    As an unsolicited FYI, I believe the app_offline.htm size threshold is an IE thing (as opposed to IIS). They’ve always seemed to serve just fine to FF, Safari, and Chrome (for custom apps and SharePoint).

    Great tip!

Leave a Reply