Yesterday I saw an interesting article about a nice ASP.Net feature written by Scott Guthrie: App_Offline.htm and working around the “IE Friendly Errors” feature

When you have a file called app_offline.htm in your website, ASP.Net will show the content of this file instead of processing all the regular stuff that should happen.
What does that mean for SharePoint?
Sometimes you have to run an update, and you wish that no user accesses the site you are updating. To accomplish this, create a file with the name app_offline.htm an place it in the root folder of the website. Example for the content:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >

<head>
<title>Application offline</title>
</head>

<body>
<h1>This application is offline for maintenance</h1>
<p>
We are running updates in this system. The application will be available as soon as possible. We are sorry to cause inconvenience.
</p>
<!--
	Add some more stuff, so the file size will reach 512 bytes minimum:

	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
	12345678901234567890123456789012345678901234567890
-->
</body>

</html>

It’s important to place this file into the inetpub-directory. You cannot use this functionality, when you place this file into the root of a SharePoint-site using SharePoint Designer.
When ASP.Net finds this file in the directory of the site, its content is sent back to the requesting client.

Now, we can run our update procedure. But remember, you cannot access the SharePoint site using a browser. You have to use STSADM-commands, PowerShell-cmdlets or your own commandline tools.

Advertisements