views:

489

answers:

7

We are rolling out a site for a client using IIS tomorrow.

I am to take the site down to the general public (Sorry, we are updating message) and allow the client to test over the weekend after we perform the upgrade.

If it is successful, I open it to everbody - if not, I rollback.

What is the easiest way to put a "We're not open" sign for the general public, but leave the rest open to testers?

+11  A: 

Redirect via IIS. Create a new website in IIS and put your "Sorry updating" message in the Default.aspx. Then switch ports between the real site (will go from 80, to something else (6666)) and the 'maintenance' site (set on 80).

Then tell your testers to go to yoursite.com:6666.

Then switch the real site back to 80 after taking down the 'maintenance' site.

Kon
That has the side effect of catching any incorrect absolute sever references in URLs from config files etc. (Which may be good or bad, depending on your point of view.)
Colonel Sponsz
@Colonel, true.. the other (less elegant) option I was thinking of was putting a redirect in the web.config or the base page.
Kon
A: 

You should have a separate test site location that is inaccessible to the public. It sounds like that's not your current situation.

My recommendation would simply be to remove all content from the site so it is not prone to URL editing. Then when the deployment happens, if there are issues, just copy back the old content.

I wouldn't disable the site, though. I don't understand why you would do that. You really do need a completely separate location to test that doesn't touch the live site, unless it's a fairly trivial site.

MrBoJangles
+2  A: 

Require that testers login. You can even hide the login page so that you need a direct link to even see it. Then, for all people not logged in, redirect to the page that displays your message.

EndangeredMassa
+1  A: 

Some methods that I've used before:

  • Windows authentication and/or separate subdomains for client to test.
  • Disable anonymous website access in IIS and give your client a username/password combo to test the website.
  • Disable default document in IIS and give your client an absolute URL to the main index file.
chakrit
+2  A: 

Fire up another "site" in IIS which will catch your host-header for your primary site. Use either a custom 404 page that has "we're down for maintainance" or use some sort of URL-rewrite to redirect people to your single static file.

switch host-header-binding on your real site to something else, like dev.domain.com or testing.domain.com that your developers use.

Or, block by IP, and have your custom "Not authorized" page tell visitors that your down to maintainance.

You have several options.

jishi
A: 

We tend to have a log in page and an include file across all pages in the site (usually the DB Connection as it's included in all files) that checks for a valid logged in session. If you've not logged in you get a message saying the site's down for maintainance

Katy
+2  A: 

I thought it would be worthwhile to mention ASP.NET 2.0+'s "app offline" feature. (Yes, I realize the questioner wants to leave the app up for testing, but I'm writing this for later readers who might come here with different needs).

If you really want to take the application offline for everyone (for instance to do server maintenance) there is a very simple option. All you have to do in ASP.NET 2.0 and higher is put a file with this name:

app_offline.htm

...in the root directory of your ASP.NET application. Put an appropriate "sorry come back later" message in there. That's it. The ASP.NET runtime does the rest.

Details on Scott Guthrie's blog.

Tim Farley