Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

ASP.NET: Using an AppOffline.htm file for updates

From Wiki

Jump to: navigation, search

Summary: Using an AppOffline.htm file for updates

When you perform maintainence on your website, rather than just letting the application go down or fall over for user's who are visiting the site it would be much better if you could inform them of this. ASP.NET makes this easy for developers through using what is known as an AppOffline.htm page. If you drop a file with this name in to the root of your application, every request for a page on your server will automatically be routed to this page and therefore shown to the user.

Here's an example of a page you can use when you are performing your maintenance:


AppOffline.htm

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <head>
  4.     <title>Site Under Construction</title>
  5. </head>
  6.  <body>
  7.     <h1>Under Construction</h1>
  8.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  9.  
  10.  <!--      
  11.     Adding additional hidden content so that IE Friendly Errors don't prevent this message from displaying
  12.     Note: it will show a "friendly" 404 error if the content isn't greater than 512 bytes.
  13.  
  14.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  15.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  16.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  17.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  18.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  19.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  20.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  21.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  22.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  23.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  24.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  25.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  26.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  27.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>
  28.     <h2>This site is temporarily down for maintainence...please check back soon.</h2>  
  29.  -->
  30.  
  31.  </body>
  32. </html>

You may also not that there are a lot of commented sections in the page above. This is simply a hack to help IIS return the page as it sometimes doesn't if there are less than 512 bytes in the page.


This Hack is part of the ASP.NET Hacks collection

488 Rating: 3.4/5 (5 votes cast)