Iso3166TwoLetterCode() and Country() Extensions returning NULL

Jul 3, 2013 at 3:21 AM
Hi,

We have recently noticed some NULL returns when calling the Iso3166TwoLetterCode() and Country() IPAddress extensions for certain IP's.

These IP addresses are mostly from Android and Apple phones using 3G network.

Is there anything special we have to do to obtain the country codes for these IP Addresses, or does it mean that my database is out of date and needs updating?

Thanks in advance (and of course for supplying this great tool!).
Coordinator
Jul 3, 2013 at 3:23 AM
My best guess is that the embedded database is out of data.

there is an extension point where u can provide your OWN database file .. so u can download the most recent one and say "use this one, please!".

try that first and report back, please :)
Jul 3, 2013 at 4:01 AM
Thanks for the prompt reply!

I downloaded the latest dataset from http://software77.net/geo-ip/ , inserted that into the WorldDomination source files, built, then replaced the dll in our software's package - and it appears that the 3G IP's are getting their country codes retrieved as expected!

As you're embedding the source data from software77 into your project - does this still agree with the terms here: http://software77.net/geo-ip/?license ?
Coordinator
Jul 3, 2013 at 4:40 AM
I guess it does. They ask you to donate something, like a dollar or more. up to you.

also, you didn't have to update the source files, there is a special extension point so u can have it side-by-side to the dll and tell the class the file name. saves people from having to play with the source cause that might be confusing/too hard for some peeps.

well done btw!
Jul 3, 2013 at 5:17 AM
Thank you for the suggestion, in the future I think we'll move towards side-by-side datasource with DLL.

I didn't have too much time to dig into the source and find the code that looks for the datasource, I assume it's part of private method ReadInCSVFile()? If you could provide some pointers into how to configure the side-by-side data source, that would be most helpful.

Also, how often would you recommend updating the CSV from software77?

Another thing, I noticed in your test method CountryTest(), the result and country list item should be cast toLower() before comparison for the Assert.IsTrue:
Assert.IsTrue(result.ToLower().StartsWith(IPAddressExtensionsTest._countryList[i].ToLower()));
Coordinator
Jul 3, 2013 at 5:23 AM
AH! i always thought i did make an extension method.

but i was wrong. It was via a PATCH: https://ipaddressextensions.codeplex.com/SourceControl/list/patches

which i never applied because i was sidetracked.
Jul 24, 2013 at 12:44 AM
Hey, I have noticed that software77.net's datasource is not only missing IP addresses, but shows some IP's country code incorrectly. E.g.:

The IP Address 116.50.58.180 shows up as HONG KONG in their datasource, but various other sources show it (correctly) as AUSTRALIA:

http://www.ip-adress.com/reverse_ip/116.50.58.180
http://whois.domaintools.com/116.50.58.180
http://whatismyipaddress.com/ip/116.50.58.180

Have you experimented with any other datasources? I would like to try and use a different source (but still use your awesome project)!
Coordinator
Jul 24, 2013 at 1:10 AM
Nope - i've never experiemented with other data sources. It's also possible that the datasource (used in the code) is now waaay out of date.

Totally open to other ideas :)
Sep 10, 2013 at 1:07 PM
purekrome wrote:
I guess it does. They ask you to donate something, like a dollar or more. up to you.

also, you didn't have to update the source files, there is a special extension point so u can have it side-by-side to the dll and tell the class the file name. saves people from having to play with the source cause that might be confusing/too hard for some peeps.

well done btw!
can you please illustrate how I can update/use this patch
Coordinator
Sep 12, 2013 at 7:10 AM
@almoujtahed : if you look at the patch uploaded to this location you can grab it and see what is needed to change the source code to allow applying OTHER data sources.
Sep 18, 2013 at 9:15 AM



Sep 18, 2013 at 9:17 AM
Thanx a lot,

this patch is what I needed !!!