Kentico Geo Blocking feature

Pavan Josyula asked on August 28, 2015 02:24

Hi All,

I am just wondering is there any way in Kentico-7 Out of the Box, I can block certain content like images/Videos/Pages based on the the end user's location.

For example: I have a video in my page I don't want users out side US to view that video.

Thank You

Pavan

Recent Answers


Brenden Kehren answered on August 28, 2015 05:42

If you have an EMS license you can use Content Personalization.

1 votesVote for this answer Mark as a Correct answer

Suneel Jhangiani answered on August 28, 2015 12:57 (last edited on August 28, 2015 12:58)

If you use a web part for displaying the video you could also use the Visibile setting under the Visibility section of the Web Part configuration. Clicking the black arrow will pull up an Editor that lets you specify a macro. You can then use a custom macro to check the users location. There is a GeoIPHelper class in the Web Analytics module and in particular a GetCountryIDByIp method that you can call to get the CMS_Country ID.

If you need to allow editors to define the countries then it can be done easily by cloning one of the media web parts and adding a field for allowed countries, you will need to handle mapping this to a field specified within the page type. You can then store a list of Country ID's in this field (either semi-colon or comma separated). In web part code behind you would then get the country ID based on User's IP and set the Visibility in the SetupControl method.

As I am not sure if Web Analytics is available in all licenses I would add here that to get the Country is simply a case of Referencing the MaxMindGeoIP DLL and then using the IPToLoctionService.getLocation(dottedQuadIp) method to get a Location and then looking up the CountryInfo which can be done using the CountryInfoProvider - CountryInfoProvider.GetCountryInfoByCode(location.countryCode).

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.