Easiest way to take your web site offline (IIS 6.0 or IIS 7.5 with .NET 4.0)

If you are running your application within a .NET 4.0 application pool (IIS 7.0 or IIS 7.5) or your web site is configured as an ASP.NET 4.0 web site (IIS 6.0) and would like to show your clients an "under maintenance" page for a limited time, the easiest way is to put a file named app_offline.htm in your web site's root folder. Then your application will be taking offline and the clients will be served with app_offline.htm page whatever their requests are.

When you are done with maintenance, just remove or rename the file and everything goes back to normal.

Applies To:

IIS 6.0, IIS 7.5 with .NET 4.0

Update:

As commented, this also works in ASP.NET 2.0 / 3.5.

--
AMB