Click to See Complete Forum and Search --> : how do i get the "referrer" ip with asp?


slyfox
11-20-2003, 12:06 PM
hi

quick background: i click on a link that send info thru to another server/site and then that server redirects info back to my server/site...

I need to read that servers ip and make sure that the info sent to my site is from the correct server... so i need it's ip... is it maybe the following..

Request.ServerVariables("HTTP_HOST")

sorry... not sure.. busy testing local:(

simflex
11-20-2003, 03:51 PM
It's more of:

Request.ServerVariables("REMOTE_ADDR")

PeOfEo
11-20-2003, 06:16 PM
try
request.ServerVariables("HTTP_REFERER"), http_host is supposed to spit up a resolved host name but often spits up an ip its self. It most certainly is not remote_addr, that will give you the users ip not the server the came from.

slyfox
11-21-2003, 05:26 AM
thanx for the input...:) but actually neither of them works for me... i tested on a server and the following happens:

HTTP_HOST: gives me the url i'm at
HTTP_REFERER: gives me the url i came from
REMOTE_ADDR: gives me my computers ip

none of them is what i need.. HOST and REFERRER comes close (but no cigar)

I need the ip instead of the place holder(url)

is there a way to do it in asp?... I know it can be done in php.. but unfortunately the server does not support php:(

PeOfEo
11-21-2003, 01:26 PM
if you came from an ip you could do it but why cant you use a url? You have two servers with the same dns but separate ip addresses that act togeter or something bizzare like that (w2k3 and w2k can be used to do this, it is good for large hosts)

slyfox
11-21-2003, 01:38 PM
hmmm... i could perhaps use the url... i just thought it would be better using the ip so if ever the referring url changes it wouldn't affect my site... never the less i'll stick with referrer:)
thanx for your thoughts PeOfEo;)

PeOfEo
11-21-2003, 04:58 PM
well there are ways to resolve ips from urls and vice versa with asp and asp.net, I just do not know them at this point :p

slyfox
11-25-2003, 12:12 PM
Hi PeOfEo

Here is the one i'm going to use:

SERVER_NAME (The IP address or Domain Name of the server.)

so if the site changes links or something, then i don't have the problem of updating my site according to referrer..

pretty cool hey:D

so if anyone asks again..;)

slyfox
01-25-2004, 04:38 PM
oh by the way...

Request.ServerVariables("REMOTE_ADDR")

..does the job!;)

PeOfEo
01-25-2004, 07:14 PM
well remote_addr gives the ip, doent it? I means whenever I use it thats what I get, thats what I use to log ips. remote_host or something (i think thats it) can be used to get the http host like
somethingsomthing.host.net.ip or whatever the heck the format for that is.
But um the HTTP_REFERER gets the page you came from. SERVER_Name will change with what is in the address bar. So if I go to http://24.129.72.170 that will be the server name but if I go to http://quasi-ke.servebeer.com it will give me that as the name. Try it, they are the same place, both are my server, and I have that var listed on the default page.

slyfox
01-30-2004, 07:25 AM
Hi PeOfEo!

OK... remote_addr get's the ip of whoever requested the page right? ...so that is great... that is what I need!

Why? Because when I post to a remote server, I also tell it where to post/comunicate back to me... in other words, the remote server then requests my page which is not from the user anymore, but from the server... so remote_addr works perfect..!

slyfox
01-30-2004, 07:33 AM
just a test sign test..