|
Server Variables To
Determine Domain
Server Variables have
many uses. We will show you a popular one here. Web sites are typically attached to an IP
address, but sometimes several domain names may point to the same IP. A clever ASP script
could display the same page different ways depending on which domain name was typed
utilizing the HTTP_HOST. Our site, for example has three domain names tied to the same IP
( activeserverpages.com, asptraining.com, learnasp.com, help.activeserverpages.com ) and
the following script will provide different results depending on what domain name it is
called from:
filename=/learn/test/server2.asp
<html><head>
<title>server2.asp</title></head>
<body>
<%
host=lcase(request.servervariables("HTTP_HOST"))
SELECT CASE host
CASE "www.asptraining.com"
response.write "Welcome Training Customer!"
CASE "www.activeserverpages.com"
response.write "Welcome To Our Reference Site!"
CASE "www.learnasp.com"
response.write "Welcome To Our Tutorial!"
CASE "www.aspeuro.com"
response.write "Welcome To Our European Site!"
CASE "www.asplists.com","www.asplist.com"
response.write "Welcome To Our ASP listservers!"
CASE "www.aspconventions.com","www.aspconvention.com"
response.write "Welcome To Our ASP convention site!"
CASE ELSE
response.write "Welcome!"
END SELECT
%>
</body></html>
|