write this code whereever u needed
string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (string.IsNullOrEmpty(ipAddress))
{
ipAddress = Request.ServerVariables["REMOTE_ADDR"];
//ipAddress = "97.96.224.60";
}
string APIKey = "ur key";
string url = string.Format("http://api.ipinfodb.com/v3/ip-city/?key={0}&ip={1}&format=json", APIKey, ipAddress);
using (WebClient client = new WebClient())
{
string json = client.DownloadString(url);
Location location = new JavaScriptSerializer().Deserialize<location>(json);
List<location> locations = new List<location>();
locations.Add(location);
s = locations[0].CountryName;
}
public class Location
{
public string CountryName{ get; set; }
}
Get API key from this site
http://ipinfodb.com/ip_location_api.php[^]
in the same way we can get more details if u need it let me know