Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to get the ip address & country of the webpage visitor

Reply
Thread Tools

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

 
 
bushi
Guest
Posts: n/a
 
      04-02-2007
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.

 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      04-02-2007
"bushi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...

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


 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      04-02-2007
"Mark Rae" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "bushi" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) oups.com...
>
>> 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...


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


 
Reply With Quote
 
Mark Rae
Guest
Posts: n/a
 
      04-02-2007
"John Saunders" <john.saunders at trizetto.com> wrote in message
news:(E-Mail Removed)...

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


Er, yes... that is, in fact, what I said...


 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-02-2007
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.



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Saunders" <john.saunders at trizetto.com> wrote in message
news:(E-Mail Removed)...
> "Mark Rae" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>> "bushi" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed) oups.com...
>>
>>> 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...

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




 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      04-02-2007
On Apr 2, 12:23 pm, "bushi" <(E-Mail Removed)> wrote:
> 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.

 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      04-02-2007
"Mark Rae" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> "John Saunders" <john.saunders at trizetto.com> wrote in message
> news:(E-Mail Removed)...
>
>>> 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.

>
> Er, yes... that is, in fact, what I said...


Sorry, I meant to reply to the OP.

John


 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      04-02-2007
"Juan T. Llibre" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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


 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      04-02-2007
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/




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"John Saunders" <john.saunders at trizetto.com> wrote in message
news:(E-Mail Removed)...
> "Juan T. Llibre" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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




 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      04-02-2007
On Apr 2, 11:58 pm, "John Saunders" <john.saunders at trizetto.com>
wrote:
> "Juan T. Llibre" <(E-Mail Removed)> wrote in messagenews:%(E-Mail Removed) l...
>
> > 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


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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
how to get the ip address & country of the webpage visitor bush ASP General 3 04-20-2007 07:06 AM
Onchange of dropdownlist say "country" loaded,it must load all "states" for that country in another drop downlist. S.Guhananth ASP .Net 1 04-30-2005 12:01 PM
Detect Visitor's Town and Country Victor ASP General 28 04-13-2005 11:15 PM
country of visitor josepe ASP General 1 12-28-2003 05:16 PM



Advertisments