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

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.
 
M

Mark Rae

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.

HttpContext.Current.Request.UserHostAddress

You can then look up the IP address on one of the many websites which
provide this sort of information e.g. http://www.completewhois.com/

However, there really is no point in doing this - IP addresses cannot be
guaranteed to be accurate because they are so easy to spoof...
 
J

John Saunders

Mark Rae said:
HttpContext.Current.Request.UserHostAddress

You can then look up the IP address on one of the many websites which
provide this sort of information e.g. http://www.completewhois.com/

However, there really is no point in doing this - IP addresses cannot be
guaranteed to be accurate because they are so easy to spoof...

Also, keep in mind that there are proxy servers and other sorts of
network-layer entities which can lie to you about IP addresses. This sort of
information is not reliable.

John
 
M

Mark Rae

Also, keep in mind that there are proxy servers and other sorts of
network-layer entities which can lie to you about IP addresses. This sort
of information is not reliable.

Er, yes... that is, in fact, what I said... :)
 
J

Juan T. Llibre

re:
!> Also, keep in mind that there are proxy servers and other sorts of network-layer
!> entities which can lie to you about IP addresses. This sort of information is not reliable.

I thought that, even though the info is not reliable to pinpoint individual users, it's reliable
when
identifying the country of origin, except for those who deliberately spoof their IP address,
which must be a minuscule portion of the total number of surfers.

There's several options available, if you don't feel like rolling your own :

MaxMind's GeoIP:

http://www.maxmind.com/app/ip-location

The APIs are at : http://www.maxmind.com/app/api
Check it out. If you like it, you may want to purchase their service.

You might also want to check out IP-to-country:
You can download their DB here : http://www.webhosting.info/
They require you to create an account.

Both MaxMind and IP-to-country have free services which you can use, besides a for-pay product.
 
G

Guest

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.

www.maxmind.com offers a free version of IP-to-Country Database and
API.
 
J

John Saunders

Juan T. Llibre said:
re:
!> Also, keep in mind that there are proxy servers and other sorts of
network-layer
!> entities which can lie to you about IP addresses. This sort of
information is not reliable.

I thought that, even though the info is not reliable to pinpoint
individual users, it's reliable when
identifying the country of origin, except for those who deliberately spoof
their IP address,
which must be a minuscule portion of the total number of surfers.

Juan, I've always been sceptical about the accuracy of these databases and
services. I'm willing to assume that they're accurate more than 90% of the
time, but no more than that.

My reasoning is simply that although IP addresses happen to be given out by
ISPs who get blocks of addresses (eventually) from National Authorities,
this was meant as a system for distributing addresses, and not as a system
for locating users of those addresses. If it happens to work, great, but
that's not the intent.

For instance, I once worked for a company based in England. Is there a rule
that says that their US offices can't use some of the IP addresses assigned
to the home office? There would be a problem with routers, but what if they
convinced the appropriate ISP/telecom companies to do the appropriate
routing?

John
 
J

Juan T. Llibre

re:
!> Juan, I've always been sceptical about the accuracy of these databases and
!> services. I'm willing to assume that they're accurate more than 90% of the
!> time, but no more than that.

Not only that, but there's obvious code deficiencies, too,
like the one which affects the IP2Location .NET Control for .NET 2.0.

http://www.ip2location.com , for example,
....places me in Miami, instead of in the Dominican Republic.

Nevertheless, reputable IP-to-country-of-origin web services do quite well,
like MaxMind, hostip.info and IP-to-Country do.

See :
http://www.maxmind.com/app/locate_my_ip
and
http://www.hostip.info/

Power apps, like "Power WHOIS Service" are quite reliable.

http://whois.webhosting.info/
 
G

Guest

Juan, I've always been sceptical about the accuracy of these databases and
services. I'm willing to assume that they're accurate more than 90% of the
time, but no more than that.

My reasoning is simply that although IP addresses happen to be given out by
ISPs who get blocks of addresses (eventually) from National Authorities,
this was meant as a system for distributing addresses, and not as a system
for locating users of those addresses. If it happens to work, great, but
that's not the intent.

For instance, I once worked for a company based in England. Is there a rule
that says that their US offices can't use some of the IP addresses assigned
to the home office? There would be a problem with routers, but what if they
convinced the appropriate ISP/telecom companies to do the appropriate
routing?

John

Sure, an IP-to-Country database gives the location of IP address, not
a user location.
 
J

John Saunders

Anon User said:
Sure, an IP-to-Country database gives the location of IP address, not
a user location.

Pardon me, but I suspect that it gives the location of the entity to which
the address has been assigned, not the location of the address.

John
 
J

Juan T. Llibre

re:
Pardon me, but I suspect that it gives the location of the entity to which the address has been
assigned, not the location of the address.

That might be a question of the accuracy of the database, John.

http://www.ip2location.com ...places me in Miami, instead of in the Dominican Republic.

MaxMind, hostip.info and IP-to-Country place me correctly.
 
J

Juan T. Llibre

IP2Location is so good that it places me in Florida, over 1,400 kilometers
away from where I really am, in another country, even.

It also gives incorrect information about our timezone,
about the ISP my IP addresses and netblock are assigned to
and even says that we have a US zipcode. All balderdash.

IP2Location has a faulty database which relies on outdated IP ownership data,
instead of relying on routing info. It's very unreliable.

MaxMind, hostip.info and IP-to-Country place me correctly.

See:
http://www.maxmind.com/app/locate_my_ip
http://www.hostip.info/
http://ip-to-country.webhosting.info/

If IP2Location is "the leading geolocation provider for .NET technology",
it's ripping off its customers by providing them with incorrect data.

I'd never consider them as a geolocation provider.
 

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,009
Latest member
GidgetGamb

Latest Threads

Top