Central on/off switch for entire websites
Posted on 2006-05-03
Using ASP.NET 2.0 and C#. Windows 2003 servers.
I would like to have a central on/off switch for an entire website.
Ideally it would work as follows:
Administrator would log onto a webpage. From that webpage there would be a list of sites. Each site could be toggled on or off. There would also be the ability to toggle all sites at once, say using a loop or something.
When a site was turned to "on" it would function normally.
When a site was turned to "off" any time it was accessed it would redirect to a "site down" page.
A few restrictions/requirements for a solution:
1) The switch cannot be stored in a database. Most often the reason the site will be down/unavailable is if the database needs maintenance
2) There should be no code needed on a per page basis in the site. It should be transparent from the individual page's point of view.
Feature Request: On/off master control page may be located on a different server.
You can assume that the web server is up and functioning - we are not worrying about that scenario.
You can assume that a person has to manually toggle the switch. It does not need to detect resources being unavailable at this time.
For example, in Cold Fusion there is a file called Application.cfm that is called before/when any page loads. This code could be put there.
Possible ideas I have had include somehow setting something in the web.config, but I have no idea how that would work.
Any ideas would be appreciated.