App_Offline.htm, an easy way to take web application offline

You can simply take down an ASP.NET 2.0 or later application offline temporarily by uploading a file called App_Offline.htm in the root of a web application directory.  While the App_Offline.htm file exists, any requests to the Web site are redirected to this file. The file displays a friendly message that tells clients that the Web site is being updated or down due to some reasons.

This is very handy when we do deployments manually. We just need to put App_Offline.htm file in root directory of web application and the ASP.NET runtime will detect the existence of  App_Offline.htm, if it exists, then the ASP.NET runtime will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application.  ASP.NET will also then respond to all requests for dynamic pages in the application by sending back the content of the App_Offline.htm file

When all Web site files have been copied, you can delete the App_offline.htm. Once removed, the next request into the application will cause ASP.NET to load the application and app-domain again, and all things will continue to work as normal.ASP.NET Web Site Application Offline

Most of the automated publishing tools or options also takes advantage of App_Offline.htm

Note: Always make sure that your App_offline.htm page is at least 512 bytes by adding filler tags or hidden text or comments as In Internet Explorer if  “Show Friendly Http Errors”  is set to true, and a server returns a non HTTP-200 status code with less than 512 bytes of content, IE will not show the returned HTML and instead substitutes its own generic status code message. In IE6 “Show Friendly Http Errors” is set to true by default.

2 thoughts on “App_Offline.htm, an easy way to take web application offline

  1. Pingback: App_Offline.htm, an easy way to take web application offline | modyrefay

  2. Pingback: App_offline.htm: The Super Weapon to Take ASP .NET Website Down | 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