In my application I want to track the client/user location to store in database. I'm using this code to get the user IP Address
string VisitorsIPAddr = string.Empty;
if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
{
VisitorsIPAddr = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString();
}
else if (HttpContext.Current.Request.UserHostAddress.Length != 0)
{
VisitorsIPAddr = HttpContext.Current.Request.UserHostAddress;
}
ipAddress = VisitorsIPAddr;
Using above code I'm getting the IP address. now the next step to get the timezone, Region, City Name, Country Name, Country Code, Weather Station, ISP etc.
But, I don't want to use any other third party API to get the details except Google. Anyone can reply to get my problem solved.
Is this possible to get the above details in asp.net using c# or I have to use any other service for that.
Using the IP I want to get the precise location of client address.
Details like http://www.iplocationtools.com/index.html
Yes, sure, Google Maps JS API v3 does provide an IP to location geocoding services. You can use this code to get the users location based on their IP address:
Beside Lat/Lng,
google.loader.ClientLocation
returns an address which include city, country, country_code, region etc...Also, look at the example here.
Even if the address is null, you can always use the returned Lat/Lng with the Geocoding Service to get the address detail.
However, just as it is mentioned in the official site:
Also in the issue tracker:
The best way to do this is with the HTML5-based approach. However, if you are using the IP-based, be sure that you realize Google can drop support to it really any time.