I am trying to fetch google distances in gridview RowDataBound with a force sleep of 1000ms,Nothing helping,Am getting correct distance for the first query,ie the first row of the gridview, all others i get 'Over-Query-Limit' for content variable ,I want to know three things:
- Is there any solution for this situation.
- Is google limiting queries per day OR
- Is google limiting queries per second ?
public int getDistance(string origin, string destination)
{
System.Threading.Thread.Sleep(1000);
int distance = 0;
string url = "http://maps.googleapis.com/maps/api/directions/json?origin=" + origin + "&destination=" + destination + "&sensor=false";
string requesturl = url;
string content = fileGetContents(requesturl);
JObject o = JObject.Parse(content);
try
{
distance = (int)o.SelectToken("routes[0].legs[0].distance.value");
return distance;
}
catch
{
return distance;
}
return distance;
}