Meeting the needs of your business from a distance

Taking an ASP.NET Application Offline

by Mark Shiffer 9/9/2008 10:33:00 AM

Republished from wiki.asp.net:

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.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Research | Websites | Programming

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag





Live preview

November 21. 2008 07:00

About the author

Name of author Mark Shiffer
CEO & CIO of MS Consulting

E-mail me Send mail

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008

    Sign in

    Copyright © 2001-2008 MS Consulting, Inc. All Rights Reserved.