Active Server Pages Programming (ASP)/ASP Domain Check?

Advertisement


Question
I 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

Answer
Hi

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

Active Server Pages Programming (ASP)

All Answers


Answers by Expert:


Ask Experts

Volunteer


Srini Nagarajan

Expertise

I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience

Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.

©2012 About.com, a part of The New York Times Company. All rights reserved.