Taking an ASP.NET website offline, the easy way

Written on

I've just come across Ryan Farley's post about taking an ASP.NET website offline, and it was something I didn't know about and I'm not sure many other people know about either. To take an entire ASP.NET website down, forget configuring IIS or anything like that - instead, simply upload a file named "app_offline.htm" into your webroot and you're done. All requests to any files in that application will be sent to the app_offline file, without you doing anything. How simple!

Before you use this approach, though, there are some situations where it's not as simple as uploading one file, such as:

  • If your ASP.NET site runs on a web farm across multiple servers.
  • If your ASP.NET site has another ASP.NET application in a virtual folder, for example.
  • If you foolishly add this file to your visual studio solution and accidentally release it when you're doing your next deployment!