how to get the ip address & country of the webpage visitor

  • Thread starter Thread starter bushi
  • Start date Start date
B

bushi

hi everyone!
i want to get the ipaddress,and the country name of a webpage
visitor,using asp.Net(C#).if anyone knows about it,plz rply me.
thanx in advance.
 
Request.UserHostAddress - will get you the ip address of the client
machine.
Request.Url - using this you can get webpage
 
Karthik pointed out how you can get the IP address. However, trying to
get the country is at best going to be a best guess, as there is nothing to
correlate an IP address and the physical location it came from.
 
Karthik pointed out how you can get the IP address. However, trying to
get the country is at best going to be a best guess, as there is nothing
to correlate an IP address and the physical location it came from.

Indeed, and spoofing an IP address is so easy anyway that it's hardly worth
doing any of this...
 
Indeed, and spoofing an IP address is so easy anyway that it's hardly
worth doing any of this...

Surely you meant to write "it's hardly worth doing any of this as a
security measure".

Most people do NOT spoof their IP address and thus there are lots of good
uses to knowing the country or even the city where a user is likely
located from.

Pete
 
Karthik pointed out how you can get the IP address. However, trying
to get the country is at best going to be a best guess, as there is
nothing to correlate an IP address and the physical location it came
from.

That's not exactly true. It's true that there is no guarantee that a
given IP address corresponds to a give geographical location. However, IP
addresses are correlated to geographical locations by a wide variety of
hosts (web sites for the most part), and generally with good success.

I'm not aware of any convenient way to do it in .NET, but it is possible
and the technology isn't exactly arcane.

Pete
 
bushi said:
i want to get the ipaddress,and the country name of a webpage
visitor,using asp.Net(C#).if anyone knows about it,plz rply me.
thanx in advance.

Other have answered about the IP address.

You can translate from IP address to country with
a 90-99% accuracy using an IP geo database.

Free such exist:
http://ip-to-country.webhosting.info/
http://www.maxmind.com/app/geoip_country

If you need C# code to load theese databases and lookup an IP just
drop a note, because I have something on the shelf.

You can also buy the service and get higher accuracy - Akamai
offers that service.

Arne
 
Ask a question here, get an answer here. The newsgroups are for everyone's
benefit, not for yours alone.

Robin S.
 
I'm contributing to this thread; STFU bitch



Ask a question here, get an answer here. The newsgroups are for everyone's
benefit, not for yours alone.

Robin S.

thanks for replying,plz send the C# code to me,it may be helpfull to
me.









- Show quoted text -
 

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

Back
Top