Friendly Error Page App_Offline.htm
Date Published: 06 October 2005
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.
To take a Web application offline before deployment
- Create a file called App_offline.htm and place it in the root of your target Web site.
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.
Remember to remove the App_offline.htm file after you are finished copying files.
Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.