All Websites or Web servers need maintenance from time to time. This article shows a very simple little ASP.NET tip that can easily keep users from accessing your site during maintenance. This is something to consider doing anytime you need to upgrade your ASNA WebPak or DataGate for IBM i, or redeploy your Web app.
To keep users from using your ASP.NET site while you’re doing maintenances or upgrades, all you need to is add an HTML file named
app_offline.htm in the root of the site. The name is very important–it’s not case sensitive but it must be named exactly as shown (
app-offline.html won’t work.)
When this file is present, ASP.NET brings the application domain down and shows the contents of the
app_offline.html file. You can provide any info necessary in that HTML. You might want to use something a little more graceful than a picture of Homer Simpson!
If any users are active when you add the file to your sites root, those users’ next requests will fail. If they were in the middle of an add or update operation, that process will fail. Be sure to schedule your downtime ahead of time with your end users.
app_offline.htm is shown, the URL shows whatever URL the user requested. When you’re ready to bring the application backup, remove or rename the
app_offline.htm file. The next user request brings the site back up.