Active Server Pages Programming (ASP)/ASP Domain Check?
Expert: Srini Nagarajan - 5/17/2005
QuestionI have a brief question about something I need to do in ASP. I have several domains pointing to the same IP address and one site that is actually hosted there. I'd like to use If statements in my index.asp to determine which domain was used to access the site, and then act accordingly by redirecting them to a site. How would I implement this domain name check?
Thanks in advance for your help.
- Steven
AnswerHi
I am Back!... Sorry for the delay in reply. I had a long business trip to Florida (did'nt goto any park! :( )
You can use HTTP_REFERER or HTTP_HOST get the value of the Site name.
Here is the sample code.
<!-- Show all server variables -->
<TABLE BORDER=2>
<TR>
<TD><B>Server Variable</B></TD>
<TD><B>Value</B></TD>
</TR>
<% For Each Item In Request.ServerVariables %>
<TR>
<TD><FONT SIZE="-1"><%= Item %></FONT></TD>
<TD><FONT SIZE="-1"><%= Request.ServerVariables(Item) %> </FONT></TD>
</TR>
<% Next %>
</TABLE>
Thanks for your patience!
Happy Programming!
-srini