Get Visitors IP Address

K

Keith

How can I grab the IP address of a visitor to my site so I can store it in a
session variable?

Thanks
 
J

Jeff Cochran

How can I grab the IP address of a visitor to my site so I can store it in a
session variable?

IPAddress = Request.ServerVariables("REMOTE_ADDR")

Jeff
 
T

teknohippy

IPAddress = Request.ServerVariables("REMOTE_ADDR")

Jeff

One word of warning, I have discovered to my downfall just yesterday
that REMOTE_ADDR can have more than one IP address in it, it can be a
comma separated list of IPs.

So look out for that if you are processing them or any such thing.

I
 
R

Ray Costanzo [MVP]

One word of warning, I have discovered to my downfall just yesterday
that REMOTE_ADDR can have more than one IP address in it, it can be a
comma separated list of IPs.

How can that be?

Ray at work
 
T

teknohippy

How can that be?

Ray at work
Surprised me as well, I've not looked at the HTTP specs yet to see
what it's all about.

The client in question was going through some kind of web cache box
thing.

REMOTE_ADDR was being reported like this (just a random made up
example)

195.148.231.128, 10.0.1.124

So I'm thinking it was the external IP of the cache machine and
possibly the internal IP of the requesting client for some reason or
another.

I
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top