Thursday, March 01, 2001 ..:: Home ::.. Register  Login
   TechTidBits (Blog)  

Ever want to take your IIS website offline quickly to do something? Check out app_offline.htm

Apr 7

Written by:
Tuesday, April 07, 2009 10:34 PM  RssIcon

Have you ever wanted to take down your website quickly but weren't quite sure how?  Ever been hit with a bad virus/hacker and want to immediately shut things down?  Have you ever wanted to do an upgrade to your website but would like to spare your users bad error messages or confusing them by seeing wonky screens of half upgrades pages?  Read on about a cool file IIS uses if it's present to take a site offline.

IIS has a cool secret up it's sleeve to quickly take a website offline.  If IIS sees a file named app_offline.htm in a website's root directory, it doesn't matter what page/file you asked for, it's going to serve up the app_offline.htm file!  Amazing!  That's the fastest way to take your website offline for maintenance, upgrades or just to have fun. :>>>>

Website offline page as seen in IE

Above is a sample app_offline.htm file I created to test this out.  Below is the sample file I used for above.

<HEAD><title> Offline</title>
	<H1> is temporarily offline.</H1> 
	<H3>Please come back again soon as we're working on the issue now.</H3>

Please note, you cannot use the "html" extension, it has to be "htm" (notice the absence of the trailing "L"?).  Well, you COULD name it that, but IIS isn' programmed to look for that filename and serve up.

There is one hiccup with this app_offline.htm scenario.  If you are creative, you could easily create an admin page to rename an app_offline.htm.backup so IIS sees it and take the website offline.  But then what?  Can you see where I'm going with this?  If you create a page to take the website offline remotely, how are you going to bring it back online?  You effictively have no more programming aspects to that website. 

The solution?  If you plan on doing this, you should either accept having to truck back into the office to delete/rename the app_offline.htm file OR create a sister website to delete/rename the app_offline.htm for you.  If you went so far as to create the admin page to take offline, I'm guessing creating the sister site isn't going to be too much work for you.

Now that you've had some fun with IIS, go grab a coffee and get coding! :>



Scott Guthrie: App_Offline.htm

15 Seconds: Taking an ASP.NET 2.0 Application Offline, John Peterson

Location: Blogs Parent Separator TechTidBits

1 comment(s) so far...

Re: Ever want to take your IIS website offline quickly to do something? Check out app_offline.htm

Interesting Finds, Jason Haley,

Very cool! I love it! :>

By phenry on   Wednesday, April 08, 2009 10:22 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Add Comment   Cancel 
Copyright 1999-2012 by   Terms Of Use  Privacy Statement