title: How to get geolocation in C#
body: <p>I have written code which give me geo-location of user based on IP Address. but when i have connect my pc with USBModem at that time it show wrong location.</p>
  
  <pre><code>string apiKey = System.Configuration.ConfigurationManager.AppSettings["ipInfoDbKey"];
  string url = "http://api.ipinfodb.com/v3/ip-city/?ip={0}&amp;key=" + apiKey;
  //string url = "http://ipinfodb.com/ip_query.php?ip={0}&amp;timezone=false";
  url = String.Format(url, ip);
  var result = XDocument.Load(url);
  var location = (from x in result.Descendants("Response")
  select new LocationInfo
  {
       City = (string)x.Element("City"),
       RegionName = (string)x.Element("RegionName"),
       Country = (string)x.Element("CountryName"),
       ZipPostalCode = (string)x.Element("CountryName"),
       Position = new LatLong
       {
            Lat = (float)x.Element("Latitude"),
            Long = (float)x.Element("Longitude")
       }
  }).First();
  return location;
  </code></pre>
  
  <p>i have done some work around the IpAddress. i have noticed one thing when i will connect any USBModem at that it take Modem IP address instead of my pc.can you please tell me how i can get geolocation when pc is connected to Modem by using PC IPaddress?   </p>