ASP.NET 2.0 introduced the ability to take an application offline simply by adding a file named App_Offline.htm to the application root folder. ASP.NET checks for the presence of this file and, if it exists, stops the app-domain so the application cannot run. In addition, ASP.NET returns the contents of App_Offline.htm to the requesting browser instead of issuing an IIS error message. This provides a very neat and user-friendly method of taking an application offline for maintenance or updates. To return the application to operating status, simply delete the file from the root of the application.
There are two issues to be aware of in using App_Offline.htm. The first is that it is located in the root of the application, not the root of the web site. So if your site is at www.sample.com and your application is at www.sample.com/application, you will need to place this file in the /application folder. Placing the App_Offline.htm at www.sample.com/App_Offline.htm will result in the application still functioning.
The second issue is that Internet Explorer issues friendly errors so as not to alarm the end user, and if the content returned from a request is less than 512 bytes, Internet Explorer will show its own error message instead of the contents of App_Offline.htm. You could just stuff App_Offline.htm with hidden content in a comment block, but a better choice would be to provide a descriptive page, along with helpful information such as alternate sources for the user, an estimate of when the application will be available or even contact information for users who continue to receive the message.
Visual Studio (all versions) uses the App_Offline.htm file while publishing the application to a web server. This means that if you have a problem publishing the application and your application stops functioning, there may be an orphaned App_Offline.htm file in your application folder.
App_Offline.htm and working around the "IE Friendly Errors" feature - Scott Guthrie
ASP.NET 2.0 Features: app_offline.htm - ASP.NET 2.0 Resources
http://aspnet.4guysfromrolla.com/articles/110707-1.aspx - 4guysfromrolla.com
Revision number 3, Tuesday, February 12, 2008 1:02:09 PM by firstname.lastname@example.org
You must Login to comment.
Thu, Jul 17, 2008 6:25 AM
Yes this is one of the better improvement in Asp.net 2.0
Sat, Feb 5, 2011 4:50 PM