In case you missed it: App_Offline.htm

I recently found out about a featured introduced in ASP.Net 2.0 that makes it pretty easy to take your application offline, which is pretty useful for when you are doing upgrades, releases, etc. I’m not sure how I missed this as it has been out there for at least a couple of years, but still wanted to do a post about it in case other people missed it as well.

Basically all you have to do is place an HTML file on your root folder with the following name: “App_Offline.htm”. Once the file is found, ASP.NET will shut-down the application and stop processing any incoming requests.  Once your down time is over, remove the file (or rename it to something like _App_Offline.htm) and your application will come back to life 🙂

Make sure your file should be at least 512 bytes otherwise you will get some IE errors (404 Errors) . The application still won’t process any requests, but the user will see an error. If your page is small and you don’t want to include more information than necessary, the trick is to include some commented code to your file to trick IE into thinking the file is bigger than it is.

Well, that is it. Better late than never 🙂 I hope it helps people who might have missed this like my self.

Advertisements

About ricardocovo

Senior Software Architect/Developer with extensive experience in web related technologies.

No comments yet... Be the first to leave a reply!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: