.net-coregeolocationmaxmind

.Net Core IP Geolocation to get Usa county value


I am currently using maxMind library to get ip geolocation. We need to do a targeting by county in the United State and there as far I a read into the docs they are do not provide county location.

I was looking into other libraries/website but I couldn't find any good tool. Do you have any idea how I can get the county for the ip?

I am using .net core 2.2


Solution

  • You could get the ZIP Code for the IP first and then lookup the county using another dataset.

    To get the ZIP Code by IP, use the IP2Location .NET Component with DN9 package. The package will give you the ZIP Code data by IP address.

    Once you get the ZIP Code, you can just refer to the below dataset to find the corresponding county.

    https://data.world/niccolley/us-zipcode-to-county-state