How would i determine the country that a spcific IP address is originating from using c#. I need to use this to check if connections originate from a specific country.
ip2cc - Lookup country and Russia region by IP address Python module with script to create database from up-to-date official data.
This Python utility loads (as frequently as you like) up-to-date information from Regional Internet Registry sites (arin, ripencc, apnic, lacnic, afrinic), as shown in the source:
url_template = 'ftp://ftp.ripe.net/pub/stats/%s/delegated-%s-latest'
sources = {}
for name in ('arin', 'ripencc', 'apnic', 'lacnic', 'afrinic'):
sources[name] = url_template % (name, name)
Once the data is loaded, queries can be answered offline and very quickly.
Can be easily modified to directly answer the original question, or used from the command line to return the country an IP address belongs to.