Welcome to AspAdvice Sign in | Join | Help

Friendly Error Page App_Offline.htm

In ASP.NET 2.0, while you're in the process of updating your site, you can expose a friendly error page by including a file called app_offline.htm in your site's root.  If this file exists, all requests to the site will be redirected to this page.  The only way to get around this is to delete the file.  The usage scenario for this is for site maintenance, and it can be easily included as part of a deployment script, where this is the first file added and the last file deleted during the deployment.  You can read more about this feature here.

Excerpt:

To take a Web application offline before deployment

  1. Create a file called App_offline.htm and place it in the root of your target Web site.

  2. Put a friendly message in the App_offline.htm file to let clients know that you are updating the site.

    While the App_offline.htm file exists, any request to the Web site will redirect to the file.

    NoteImportant

    Remember to remove the App_offline.htm file after you are finished copying files.

Published Wednesday, October 05, 2005 8:33 PM by ssmith
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Feature ASP.NET 2.0 feature

Several developers blogged about the feature regarding the App_Offline.htm file, which is used to redirect...
Thursday, October 06, 2005 10:22 PM by Sonu on .net

# Feature: ASP.NET 2.0 feature

Feature: ASP.NET 2.0 feature
Friday, November 11, 2005 2:55 PM by Sonu on .net (DotNetSlackers blog)

# re: Friendly Error Page App_Offline.htm

Simply removing app_offline.html, at least on our servers, under Windows Server 2003 leaves the application pool in some strange state. I have to recycle the application pool following removal in order to keep the site from 404'ing everything afterwards!

Sunday, September 30, 2007 9:56 AM by Chris

# re: Friendly Error Page App_Offline.htm

Nice article boy.

Wednesday, December 12, 2007 11:17 AM by Ivan Atanasov

# app_offline.htm not working

Hi All, Could anyone please help me with this. On the production site app_offline.htm works only till you start uploading dlls. As soon as you start uploading dlls it throws following error"Could not load file or assembly 'SubSonic' or one of its dependencies. The process cannot access the file because it is being used by another process. Now this clearly shows that IIS is still trying to serve the aspx page?? Is there anything I am missing here?? Any help would be appreciated. I have spent hours googling but to no avail. Thanks in advance. Manisha

Tuesday, December 16, 2008 10:19 PM by Manisha

Leave a Comment

(required) 
required 
(required) 
Enter the code you see below