Getting IP address of visitor?

B

brett

How can I get the IP address of a visitor to my site in ASP.NET 2.0?
Please include the full namespace.

Thanks,
Brett
 
G

Guest

Hi,
string ip=HttpContext.Current.Request.UserHostAddress;

Regards,
Mohamed Mosalem
 
M

Mark Rae

How can I get the IP address of a visitor to my site in ASP.NET 2.0?
Please include the full namespace.

In addition to the replies you've already received, you simply cannot place
any trust whatsoever that the IP address being reported is genuine.

It is the simplest thing in the world to spoof an IP address...
 
M

Mark Rae

Like this.

A quick inspection of the message properties of this post and the before the
previous one will tell you that they are from an IP address in London.

But the one in the middle looks as if it's come from Wilmington, Delaware...

I assure you it hasn't...

This really is so easy to do that capturing the IP address of incomg
requests to a website is almost not worth the bother...
 
B

brett

This really is so easy to do that capturing the IP address of incomg
requests to a website is almost not worth the bother...

Well, I'm just trying to keep some javascript tracking code from
tracking my IP, which I won't be spoofing. I'm guessing it should work
fine in that case. The IP doesn't change.

Thanks,
Brett
 
M

Mark Rae

Well, I'm just trying to keep some javascript tracking code from
tracking my IP, which I won't be spoofing. I'm guessing it should work
fine in that case. The IP doesn't change.

Er, so now you're looking for a way to *prevent* your IP address from being
tracked by JavaScript code...?
 
K

kpg

As Mark Rae once said in microsoft.public.dotnet.framework.aspnet
Er, so now you're looking for a way to *prevent* your IP address from
being tracked by JavaScript code...?

Sounds like he doesn't want *his* visits tracked, just *real* visitors.

Or is could be more insidious... :)
 
M

Mark Rae

Sounds like he doesn't want *his* visits tracked, just *real* visitors.

Oh right - yes, I see what you mean now...

In which case, it's dead easy, as the first two replies have described...
Or is could be more insidious... :)

Let's give him the benefit of the doubt... :)
 

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,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top