smithsson68@gmail.com
Jul 4, 2011
  6242
(1 votes)

Automatically Updating the Geo-IP Database

Last week, David Knipe blogged about how to update the MaxMind GeoIP database that ships with the EPiServer Framework.

This inspired me to create an EPiServer Scheduled Job to do this automatically:

image

As the job needs to download a file from the internet, which could be a lengthy operation, I made it a ‘stoppable’ job. You can read more about stoppable scheduled jobs here.

The job also has a settings page where you can adjust the URL of the downloadable database file as well as a couple of other settings:

image

It seems that MaxMind update their ‘Lite’ database on the 1st of every month so it’s probably a good idea to schedule the job for the 2nd of every month.

You can obtain a Deployment Center Zip Module here to add the functionality to a site or if you want the source code then download the EPiServer.Extensions.GeoIPUpdate.1.0.nupkg package from nuget.episerver.com.

The code has been tested but of course if you find any bugs or have any suggestions for improvements then please let me know.

Happy updating!

Jul 04, 2011

Comments

Jul 4, 2011 08:02 PM

Great stuff! Thanks Paul. I've updated my original post :)

Jul 18, 2011 11:06 PM

Nice! We had a question about this shortly after the R2 release and now a more complete answer.

Jørgen Helgheim
Jørgen Helgheim Mar 12, 2014 11:02 AM

Nice.

One fix to the code:
You should replace the line _liveDatabaseFileName = maxmindProviderConfig.Parameters["databaseFileName"]; with _liveDatabaseFileName = Web.VirtualPathUtilityEx.RebasePhysicalPath(maxmindProviderConfig.Parameters["databaseFileName"]); in the property LiveDatabaseFileName in the file UpdateDatabase.cs. To take acount of the appdata path.

For thoose wanting to use this code in CMS 7 or 7.5 you should make GeoIPUpdateAdmin.aspx.cs inherit WebFormsBase instead of SystemPageBase. and then you do not need to override Page_PreInit to set MasterPageFile, because this is already part of the WebFormsBase class.

valdis
valdis Jan 27, 2015 05:54 PM

Is it open sourced?

Please login to comment.
Latest blogs
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024

Frontend Hosting for SaaS CMS Solutions

Introduction Now that CMS SaaS Core has gone into general availability, it is a good time to start discussing where to host the head. SaaS Core is...

Minesh Shah (Netcel) | Jul 20, 2024

Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024