Views: 2174
Number of votes: 8
Average rating:

maxmind geolite2 on nuget

GeoIP2 is MaxMind's newest IP intelligence offering and is available in different flavours. EPiServer's geo location visitor group is depending on MaxMind's legacy database that they are not updating any more, following nuget package 'PixieEPiServerExtensionMaxMindGeoIP2' can be an option. It is based on MaxMind.Db and MaxMind.GeoIP2 apis. Code is available on GIT. It has been implemented as a service that potentially can be replace with your own geo location service also. Same service can be used out side of visitor group also

e.g

GeolocationMaxmindService service = new GeolocationMaxmindService();
            NameValueCollection config = new NameValueCollection();
            config.Add("databaseFileName", @"C:\EPiServer\Extension\Maxmind\GIT\Maxmind.GeoIP\GeoIpTests\db\GeoLite2-City.mmdb");
            var result = service.GetGeoLocation(IPAddress.Parse("213.205.251.152"), config);
            

Following settings will require to use it in vistor group criteria.

<geolocation defaultProvider="maxmind">
      <providers>
        <add name="maxmind" type="Pixie.Extensions.Maxmind.GeoIp.Provider.MaxmindGeoIp2, Pixie.Extensions.Maxmind.GeoIp" databaseFileName="App_Data\GeoLite2-City.mmdb" />
        <!--<add name="maxmind" type="EPiServer.Personalization.Providers.MaxMind.GeolocationProvider, EPiServer.ApplicationModules" databaseFileName="App_Data\GeoLiteCity.dat" />-->
      </providers>
    </geolocation>
Oct 30, 2016

Aria Zanganeh
(By Aria Zanganeh, 10/31/2016 12:55:06 AM)

Great job .. I was thinking about similar concept to use Google API! 

K Khan
(By K Khan , 11/3/2016 10:42:48 AM)

@Aria, Thanks, Glad, you like it.

jafe
(By jafe, 2/1/2017 11:30:26 AM)

Good work.

Does the nuget Package contain a job to automatically update the Geo lite2 database?

K Khan
(By K Khan , 2/1/2017 10:58:24 PM)

@janaka, thanks for the feed back, it's not available at the time, but I will consider this. Personally I prefer controlled upload of these kind of files on prod.

Please login to comment.