Take your application offline using app_offline.htm

« View all ASP.net articles

December 16, 2006

ASP.net 2.0 has a new feature that you can quickly take your application down while you make changes to it.

Create an HTML file and name it app_offline.htm. Place the file in the root directory of your website. When the app_offline.htm file is present, the ASP.net application will discountinue serving your pages. Instead it will display the contents of the app_offline.htm. When the file is deleted, the site will come back online.

One caveat as explained on Scott Guthrie's Blog is that the file must be over 512 bytes. If you do not have enough content to make the file over 512 bytes, he suggests using HTML comments in the code:

<!--

    Adding additional hidden content so that IE Friendly Errors don't prevent this message from displaying    

    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>
    <h2>Comment goes here.. </h2>

-->