Config: Win2K, IIS5.0
My solution requires that the host header sent to IIS be analyzed. I have
set up a web site that responds to both www.domain.com and domain.com. In
DNS, both a WWW and a * A record exist, so either www.domain.com or
domain.com gets directed to the same web site. However, I wish for
whatever.domain .com to point to the same web site and for my ASP page to
analyze the URL to determine what (if any) was entered BEFORE domain.com. A
VERY simple example would look like this:
<begin example>
TheVirtualServe r=GetVirtualSer ver(Request.Som ething("URL")," .domain.com")
If TheVirtualServe r then
Response.Write TheVirtualServe r & " was entered"
Else
Response.Write "No virtual server name was supplied"
End If
Function GetVirtualServe r(TheURLEntered , TheDomainToBeCh ecked)
GetVirtualDomai n=Left(TheURLEn tered,Instr(1,T heURLEntered,
TheDomainToBeCh ecked)-1)
End Function
<end example>
Now a user entering "domain.com " as the url should get "No virtual server
name was supplied", whereas a user entering "anything.domai n.com" would see
"anything was entered". The challenge: how to have a web server with
www.domain.com and "domain.com " (and/or *.domain.com) as configured host
header to handle ANY request ending in "domain.com " AND how to analyze the
URL passed by the user?
Thanks,
Rob