Tuesday, April 21, 2009

Using App_Offline feature when updating your web site

Hi Guys,
Here's the convenient way to bring down an ASP.NET web site while we update it. Just create an App_Offline.htm file and place it to the root directory of the web site. Whenever the ASP.NET engine finds this file in the root directory, it will render App_Offline.htm for any request that is directed towards the web site.

Here is the sample listing for App_Offline.htm:
<!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>Site Under Construction</title>
</head>
<body>
<h1>Under
Construction</h1>

<h2>This site will be up
again from 9:00 pm...We regret for
the inconvinience</h2>
<!--
Adding additional hidden content so that IE Friendly Errors
don't
prevent
this message from displaying (note: it will show a
"friendly" 404
error if the content isn't of a certain size. Best if the
size is
>= 512 bytes. Thanking scott for pointing this workaround
tip).
<span>We regret for the inconvinience. We regret for the
inconvinience.
We regret for the inconvinience. We regret for the
inconvinience. We regret for
the inconvinience. We regret for the
inconvinience. We regret for the inconvinience.
We regret for the
inconvinience. We regret for the inconvinience. We regret for
the
inconvinience. We regret for the inconvinience. We regret for the inconvinience.
We regret for the inconvinience. We regret for the inconvinience. We regret
for
the inconvinience. We regret for the inconvinience. We regret for the
inconvinience.
We regret for the inconvinience. </span>
-->
</body>
</html>
That's it.

No comments: