views:

798

answers:

7

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.

+1  A: 

You can use a service such as: http://freegeoip.appspot.com/

It will not be completely accurate.

Here is a tutorial on consuming the service using ASP.Net.

thedugas
Hi Thedugas, http://freegeoip.appspot.com/ is not working properly and I have implemented the same thing it is throwing an error 503. Might be this service is stopped. :( Please let me know if you have other thoughts.Thanks again for your reply.
Zerotoinfinite
A: 

Try MaxMind

codaddict
Thanks Unicomaddict,But it is not free :( . Any other link !!
Zerotoinfinite
+1  A: 

Similar question (in PHP) with good answers here:

http://stackoverflow.com/questions/1077455/tool-or-php-code-to-convert-ip-address-into-lat-lng-coordinates

Bill X
Hi Bill,Maxmind is not a free tool. Please suggest me another way.
Zerotoinfinite
A: 

http://www.ip-adress.com

http://whatismyipaddress.com/

drewk
Zerotoinfinite
+4  A: 

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:

<Response>
  <Ip>69.59.196.211</Ip>
  <Status>OK</Status>
  <CountryCode>US</CountryCode>
  <CountryName>United States</CountryName>
  <RegionCode>41</RegionCode>
  <RegionName>Oregon</RegionName>
  <City>Corvallis</City>
  <ZipPostalCode>97333</ZipPostalCode>
  <Latitude>44.4698</Latitude>
  <Longitude>-123.343</Longitude>
</Response>

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

fmark
A: 

Try IPInfoDB which, as far as I know, is free.

They provide downloadable databases, but the easiest solution seems to be the XML api. Examples provided are for php, but I'm sure it's equally accessible with ASP.Net.

lsc
+2  A: 

This question has been asked around many times,. But if you are looking for more accurate data, I suggest you to try out IP2Location. Many Maps service website companies around the world are using the geolocation service from its for the accuracy result.

SuperRomia