Tuesday, January 6, 2009

Using GeoIP's GeoLite to find an IP address City using C# .Net

There’s a terrific open source product offered by MaxMind called GeoLite City that is a binary (or CSV) database for doing IP location lookups.  There are many flavors of the GeoIP API that provide optimized access to the .DAT file, including C# and VB.Net (Country only).  The C# version is a collection of 5 classes and is very easy to use:

Dim ls As New LookupService("C:\GeoIP\GeoLiteCity.dat")
Dim IPLoc As Location = ls.getLocation(IPString)

 

3 comments:

sri said...

ok.It's nice way to find the ip address.
But there is a site called ip-details contains the details of ip address.It is used to find the location of ip address and global longitude and latitude of coordinates.

goshi said...

i need complete code for read from xml file and write into database.

Anonymous said...

Thanks for this supersimple example - exactly what I was looking for!