views:

773

answers:

6

Hi.

I've developed my first web application which, surprisingly, is getting very popular.

Because the website is now live, I have a hard time doing some changes, in fear some people are still logged in and are using the application.

I wish to avoid having a duplicated instance of the web application for testing.

Is there any way to put the website in 'maintenance mode' with only me having access to it? Like redirecting to a page with some info, telling its in maintenance mode.

Thanks. :-)

+14  A: 

You can simply drop a file called app_offline.htm in the root of your website and ASP.NET will automatically route all traffic to this page. This file can contain any HTML you wish indicating that your site is down for a short period due to maintenance.

For more information please read App_Offline.htm and working around the "IE Friendly Errors" feature:

The way app_offline.htm works is that you place this file in the root of the application. When ASP.NET sees it, it will shut-down the app-domain for the application (and not restart it for requests) and instead send back the contents of the app_offline.htm file in response to all new dynamic requests for the application. When you are done updating the site, just delete the file and it will come back online.

Andrew Hare
A: 

What version of ASP.NET? I'm sure there are a million more elegant ways of doing this, but you can change the Default Document in IIS to redirect to Maint.html (or similar).

Ian Jacobs
+1  A: 

Try app_offline.htm ??

Shoban
+4  A: 

There's no such built-in functionality in ASP.NET except app_offline.htm which doesn't quite fit your needs because even you will be denied access to the site. You have to build it on your own but this is best done on the routers and load balancers level than at the application level. Of course this will depend on your network architecture.

Darin Dimitrov
+20  A: 

I wish to avoid having a duplicated instance of the web application for testing.

That's your problem right there. For anything but the most trivial sites, you should have a staging or development instance. You should be using source control and have a script to update the main instance.

jskulski
Very good point. Something I will have to consider that. This project really have got me into some different aspects. :-)
meep
+1 @jskulski. I don't think this point can be stressed enough. You need to have at the very least a stage/UAT environment that matches your production environment as much as possible. Make your mistakes there instead of production. Even better to have a development environment and script your changes from there to Stage. That lets you catch the deployment bugs and allows for a smooth production rollout.
wcm
This will be my solution, I better look into source control. Never been using it before. Thanks for pointing me in a new direction! If there is something I have to read about source control, I would be happy if you would share the information. :-)
meep
Look into "Subversion" (also called SVN) and "TortoiseSVN".
Vilx-
+2  A: 

Besides building a dev replica of your website to build patches and fixes on, couldn't you just announce a site closing for maintenance several days in advance? I'm not a web programmer, but you might want look into what Hattrick, a popular online soccer management, does for maintaining their site. They use a notification system on the homepage, after users sign-in, that announces when maintenance will be taking place (usually late at night in Europe where a large portion of the players and all the devs are located) and they close down the website for a couple of hours. When they take the site down they post a page, using the same style as the rest of the site, and provide an estimate of when it will be up and running again. Simple, elegant, and when coupled with the long forewarning it seems to do a good job placating the user base.

Give users a long heads up that planned maintenance is scheduled to take place and give them some idea what it is for and most people will be able to accommodate the down time. Nothing is more frustrating than purposefully going to a web app that was up and running 10-20 minutes ago to find it suddenly unavailable and down for maintenance.