Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retreiving domain name when many point to the same server 1

Status
Not open for further replies.

jamesa74

Programmer
Jan 10, 2001
20
0
0
IL
different domain names are directed to my IIS 4.0 IP address. they all reach the same asp file. each one of the has to be treated differently.
how can i know in the asp code, the domain that was requested by the user?
 
Set up different web sites in IIS, each on a different port (i.e. not port 80). Each site then does a re-direct to your real home page. You can then look in the referring page property of the request object to see where it came from.

Only downside is some clients running behind a firewall aren't going to be able to open a non-port-80 site.

Chip H.
 
Didn't understand? are you hosting different domains on one phisical web site? that means hosting a site with multiple header URL, try to create a site for each domain in IIS ,make them all redirections to your asp file but add at the end of the redirection url a query variable like:
main.asp?dom=1 .. for each domain give it different value,
now in the asp type:

request.querystring("dom")
selecte case dom
case 1
'performe actions for domain 1 like
response.redirect("domain1.asp")
case 2
...domain 2 actions
case else
'if not coming from any domain
response.write"You came here by mistake, get lost!.. Shuu! :eek:) "
end select



rgrds Silvers5
As seen on EE
 
i'm affraid this doesn't help me.
I don't want (and can't, for various reasons) to create virtual servers in either of the two ways suggested ("create a site for each domain" or "Set up different web sites in IIS, each on a different port").
i want to solve this without changing the IIS architecture.
 
Hmmm.. not possible then.. you cant! there are things that cant be done other ways! you can try in a way to fetch the header server variable request.servervariables("All-Http") and try to get in it the header the client's request header.. but this is more difficult.. browsers send different headers..
try it Silvers5
As seen on EE
 
Thank you silvers5, your post was helpful.

A more accurate way though is to retreive the request.servervariables("server_name") (which i found out about thanks to you!).

it gives you the Domain name withougt any additional information.

Do you think different browsers would give different results? isn't this a server - browser - indipendent value?
 
it's a server variable independant of the client.. Silvers5
As seen on EE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top