Search code examples
asp.netgeolocationtrace

Get Country,City name from IPAddress


can we trace the user geographical location in asp.net , I know we can get the user IP address or ServerVariables("REMOTE_ADDR") but my need is to check the visitors by city name so can my client use this data for his business


Solution

  • As I said in my comment:

    I am not .net guy, I am actually a PHP dev but this is quite universal across board. Yes, you can get A country and A city, but as to whether it is your users COUNTRY and CITY....well it is unlikely to be your users city since most ISPs do not hold their exchanges in the same city as the user...but you have a good chance with country.

    But I thought I would elaborate a bit.

    The country, especially if they are like me and using an encrypted proxy, won't be of any help to you, however services like cloudflare will give you the users IP country in HTTP headers, and it's free. Better than spending £200 a month on getting nothing but false positives from dedicated services.