Click to See Complete Forum and Search --> : Retrieve the IP Address of a Website Visitor


millseyno1
02-02-2009, 05:56 AM
I am trying to get the IP address of visitors to my website, but all i manage to get is the IP of the firewall. Can you help?

Code Currently Used

Dim strIpAddress
strIpAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If strIpAddress = "" Then
strIpAddress = Request.ServerVariables("REMOTE_ADDR")
End If
IpAddress = strIpAddress

downtime
02-02-2009, 10:44 PM
Request.ServerVariables("LOCAL_ADDR") is the IP address of the person visiting your site, I believe.

buntine
02-02-2009, 11:38 PM
Request.ServerVariables("LOCAL_ADDR") is the IP address of the person visiting your site, I believe.
Hey yo. This will actually return the local IP of the server that is accepting the request.

REMOTE_ADDR is the correct server variable, but unfortunately you can only access the values that were sent along as headers with the request.

I am not familiar enough with the security side of things to know if you can get around it, but I would doubt it.