App_offline.htm: The Super Weapon to Take ASP .NET Website Down


When I am doing maintenance work for my ASP .NET web application, I will always take down the web application temporarily. This is because the application domain will always restart when I deploy a new version of the application. Hence, in order to prevent online users to make request when the website is still under deployment, there is a need to take the website down and then show the online users a friendly message that my website is currently unavailable.

Two Steps to Take Website Down

Luckily, there is a very convenient way of doing that in ASP .NET 2.0 or later.

Firstly, a file with the name “App_offline.htm” needs to be created. This is the only web page that will be shown to the online visitors when the website is down. Thus, we will put our friendly messages to notify the visitors that the website is currently under maintenance in the web page.

Secondly, we will put this file in the root of the website virtual directory.

Finally, visit the website now. You will realize that no matter which web page you visit in the website, you will always be redirected to App_offline.htm, the page telling you that the website is under maintenance.

Website is under maintenance. Sorry about that!

Website is under maintenance. Sorry about that!

Things to Take Note of

Current Request Still Be Processed

According to an interesting experiment shared on Stack Overflow, only new request will be redirected to the App_Offline.htm. Existing requests when the App_Offline.htm is uploaded will still be processed.

Minimum of 512 Bytes

It turns out that Internet Explorer will show its own generic status code message if the App_Offline.htm contains less than 512 bytes.

Permission of App_offline.htm

Yes, check the permission of the file under Properties -> Security because if the App_offline.html doesn’t have correct permissions given, it will not work as expected as well.


As demonstrated above, it is indeed very easy to take an ASP .NET website down. What a convenient App_offline.htm!


One thought on “App_offline.htm: The Super Weapon to Take ASP .NET Website Down

  1. Pingback: Journey to Microsoft Azure: Good and Bad Times | cuteprogramming

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s