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

Discussion in 'ASP .Net' started by bushi, Apr 2, 2007.

  1. bushi

    bushi 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.
     
    bushi, Apr 2, 2007
    #1
    1. Advertising

  2. bushi

    Mark Rae Guest

    "bushi" <> wrote in message
    news:...

    > 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...
     
    Mark Rae, Apr 2, 2007
    #2
    1. Advertising

  3. "Mark Rae" <> wrote in message
    news:...
    > "bushi" <> wrote in message
    > news:...
    >
    >> 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
     
    John Saunders, Apr 2, 2007
    #3
  4. bushi

    Mark Rae Guest

    "John Saunders" <john.saunders at trizetto.com> wrote in message
    news:...

    >> 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... :)
     
    Mark Rae, Apr 2, 2007
    #4
  5. 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:...
    > "Mark Rae" <> wrote in message news:...
    >> "bushi" <> wrote in message
    >> news:...
    >>
    >>> 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
    >
    >
     
    Juan T. Llibre, Apr 2, 2007
    #5
  6. On Apr 2, 12:23 pm, "bushi" <> 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.
     
    Alexey Smirnov, Apr 2, 2007
    #6
  7. "Mark Rae" <> wrote in message
    news:%...
    > "John Saunders" <john.saunders at trizetto.com> wrote in message
    > news:...
    >
    >>> 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
     
    John Saunders, Apr 2, 2007
    #7
  8. "Juan T. Llibre" <> wrote in message
    news:%...
    > 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
     
    John Saunders, Apr 2, 2007
    #8
  9. 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:...
    > "Juan T. Llibre" <> wrote in message
    > news:%...
    >> 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
     
    Juan T. Llibre, Apr 2, 2007
    #9
  10. On Apr 2, 11:58 pm, "John Saunders" <john.saunders at trizetto.com>
    wrote:
    > "Juan T. Llibre" <> wrote in messagenews:%...
    >
    > > 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.
     
    Alexey Smirnov, Apr 2, 2007
    #10
  11. "Alexey Smirnov" <> wrote in message
    news:...
    > On Apr 2, 11:58 pm, "John Saunders" <john.saunders at trizetto.com>
    > wrote:
    >> "Juan T. Llibre" <> wrote in
    >> messagenews:%...
    >>
    >> > 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.


    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
     
    John Saunders, Apr 3, 2007
    #11
  12. 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.



    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:...
    > "Alexey Smirnov" <> wrote in message
    > news:...
    >> On Apr 2, 11:58 pm, "John Saunders" <john.saunders at trizetto.com>
    >> wrote:
    >>> "Juan T. Llibre" <> wrote in
    >>> messagenews:%...
    >>>
    >>> > 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.


    > 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
    >
    >
     
    Juan T. Llibre, Apr 3, 2007
    #12
  13. bushi

    Guest

    , Apr 22, 2007
    #13
  14. 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.




    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/
    ===================================
    <> wrote in message
    news:...
    > The IP2Location is the leading geolocation provider for .NET
    > technology.
    >
    > http://www.ip2location.com
    >
     
    Juan T. Llibre, Apr 22, 2007
    #14
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S.Guhananth
    Replies:
    1
    Views:
    575
    Alvin Bruney [Microsoft MVP]
    Apr 30, 2005
  2. Zyron
    Replies:
    2
    Views:
    1,542
    Jukka K. Korpela
    Nov 8, 2005
  3. josepe

    country of visitor

    josepe, Dec 28, 2003, in forum: ASP General
    Replies:
    1
    Views:
    107
    Foo Man Chew
    Dec 28, 2003
  4. bush
    Replies:
    3
    Views:
    308
  5. Petr Janda
    Replies:
    2
    Views:
    182
    rretzbach
    Mar 8, 2007
Loading...

Share This Page