Longitude and latitude value from IP address

后端 未结 6 540
遇见更好的自我
遇见更好的自我 2020-12-02 08:01

Is it possible to get the longitude and latitude value from IP address in asp.net? If it is possible, please let me know how can I get this.

6条回答
  •  执笔经年
    2020-12-02 08:29

    MaxMind Geolite city is free. If it is not good enough, you can apparently upgrade to a more accurate paid-version. I can't speak for the quality of the paid version, as I have never used it.

    If you like your SQL, download the CSV version. Load it into your database of choice, and query away.

    The faster and space-efficient option is to download the file binary blob version of the same database, and then use the C# class to query it.

    Alternatively, I have found ipinfodb.com to be useful. Query is by simple HTTP GET. For example, to geolocate stackoverflow.com try:

    http://ipinfodb.com/ip_query.php?timezone=false&ip=69.59.196.211
    

    This will return an XML file containing latitude and longitude, that looks like:

    
      69.59.196.211
      OK
      US
      United States
      41
      Oregon
      Corvallis
      97333
      44.4698
      -123.343
    
    

    Some VB.NET sample code is available at http://forum.ipinfodb.com/viewtopic.php?f=7&t=269

提交回复
热议问题