How to obtain geographical information based on IP address using API

  • Updated

This is a code sample on how to obtain the geographical information based on user IP address for testing purposes:

 

Note: This will not work for private IP addresses ONLY public IP addresses.

Code Sample

 

Please note that this sample can be used in conjunction with the following API call to test various IP addresses. This is useful for testing if your IP address is located in the GEOIP database or not.

Ektron.Cms.UserContext.OverrideIP("external.ip.here.");