This is a .NET 3.5 library that retrieves the country information for an Internet Protocol version 4 (IPv4) Address, by extending the System.Net.IPAddress class.
The most common use for this library would be determining the destination of a user connecting to your website or application. You could then localise the webpages or data based on there IPv4 address geospatial location.
- Country name (eg. Australia)
- Country ISO 3166 2-Code (eg. AU)
- Country ISO 3166 3-Code (eg. AUS)
- Registry. (eg. APNIC)
- Date the IP Address (range) was added to the data source (if known).
Sample C# code
string userHostIpAddress = "22.214.171.124";
if (IPAddress.TryParse(userHostIpAddress, out ipAddress))
string country = ipAddress.Country(); // return value: UNITED STATES
string iso3166TwoLetterCode = ipAddress.Iso3166TwoLetterCode(); // return value: US
The project was developed with the following :-
- .NET 3.5 framework :: automatic properties, extension methods and anonymous types,
- LINQ to OBJECTS to retrieve the data
- Free geospatial data provided kindly by Webnet77 under the terms of the General Public License.
-= Update 23rd May 2008 =-
Codeplex team didn't like my original logo and locked the project (thanks guys for notifying me!). Logo updated, project reopened. Appologies for any inconvience this might have caused.