1

We're about to do some major maintanence on an IIS 6 / ASP (Classic) website. We want all visitors to be redirected to a "Coming Soon" page (or something similar). This should NOT apply to our dev team (operating remotely), so we'd want to specify certain IPs that should have access to the under-construction site.

How can this be accomplished in IIS 6? (Using classic ASP if needed)

Colin O'Dell
  • 135
  • 1
  • 7

2 Answers2

6

To do this without modifying any code, an alternative is in IIS6 do the following:

  1. Deny access to all ip addresses except those of your developers
    (in IIS6 Manager, go to the web directory -> properties -> Directory Security -> "IP address and domain name restrictions"

  2. Change the error response for http error 403.6 to point to your "Coming Soon" static html page.
    (In IIS6 Manager go to the web directory -> properties -> "Custom Errors" -> click on the row for "403;6" and edit the location to point to your html file.)

Important: Your html page must be large enough or many versions of Internet Explorer will display their so-called "friendly" error message instead of your content. I believe the threshold is that it must be larger than 512 bytes. See: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q294807

Nathan
  • 306
  • 1
  • 5
  • 13
2

Creade a default.asp page with code similar to the following:

<% IF Request.ServerVariables("REMOTE_ADDR") = special_ip_address THEN
    Respose.Redirect("/standard_home_page.asp")
  ELSE
    Response.Redirect("/coming_soon.asp")
  END IF %>
Massimo
  • 70,200
  • 57
  • 200
  • 323
  • This would work great for all direct traffic to the homepage, but what about traffic to other pages? – Colin O'Dell Sep 19 '09 at 08:02
  • No solution for that. AFAIK, IIS can show different sites if it is asked for different host headers and/or different IPs, but it can't do different things based on the **client** IP. Unless you put an ISAPI filter in the middle... – Massimo Sep 19 '09 at 12:41
  • 1
    You could use Massimo's code in global.asa in the Script_OnStart section. Just have it redirect them to another site that you setup since this is only fired once per session and you don't want them navigating back after the first try. (IIRC Classic ASP doesn't have an event handler that is fired on every request). The other limitation is that this doesn't address non-ASP pages. The ideal way to do this in IIS6 is with an ISAPI filter like ISAPI Rewrite (www.isapirewrite.com). That can do exactly what you need. – Scott Forsyth Sep 20 '09 at 22:07