Developer forum

Forum » Development » Info from IP adress

Info from IP adress


Reply
 Hi,

Can I use the Dynamicweb API to retrieve information about the visitors IP adress. If so could someone point me to the right direction.

Regards / Aki


Replies

 
Reply

What kind of information do you need?
 
If you just need basic information like the visitors country, you can get it by using Dynamicweb.CountryLookup.
 
var clientIP = Request.UserHostAddress;
var geoIPData = Server.MapPath(Dynamicweb.StatisticsV3.Consts.GeoIPData);
var lookup = new CountryLookup(geoIPData);
var country = lookup.getCountry(clientIP);
var countryName = country.getName();
var countryCode = country.getCode();
 
An alternative is MaxMind:
http://www.maxmind.com/app/ip-location
 
Does it have to be server side? How about Google ClientLocation?
http://code.google.com/p/gmaps-samples/source/browse/trunk/clientlocation/clientlocation.html
 
/Morten
 
Reply
 Thanks for your input.

What I'm after is the "kommun" information. 

I would prefer server-sida but I guess I can solve it with clientside also. 

Does not look like Google provides the kommun information though.

/Aki

 
Reply

You can use Google ClientLocation to get the location (longitude, latitude). 

When you know the location you can lookup the municipality (kommune) using something like http://geo.oiorest.dk/documentation/api/kommune.aspx or from a database like the one available at http://www.kms.dk/Produktkatalog/DAGI/

/Morten
 
Reply
 Exaclty my plan. 

Thank for your help.

Regards / Aki

 

You must be logged in to post in the forum