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
Developer forum
E-mail notifications
Info from IP adress
Posted on 14/01/2011 13:42:38
Replies
Posted on 16/01/2011 19:55:52
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
Posted on 17/01/2011 09:16:59
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
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
Posted on 17/01/2011 10:51:07
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
Posted on 17/01/2011 11:07:11
Exaclty my plan.
Thank for your help.
Regards / Aki
Thank for your help.
Regards / Aki
You must be logged in to post in the forum