Click here to Skip to main content
14,666,366 members
Rate this:
Please Sign up or sign in to vote.

Hey,

I'm facing a very peculiar problem, I am using google maps API for a webpage.

The objective is to get the Google Pin point on the Map for the addresses that the user has entered. While doing this I get the following error
"THE REMOTE SERVER RETURNED AN ERROR - 403 FORBIDDEN"

Occasionally it does works fine (but on my local system it always works).

I am using the following code to get the reference from Google API (i.e., longitude,latitude)

WebRequest objWebRequest = WebRequest.Create(geoURL);
WebResponse objWebResponse = objWebRequest.GetResponse();

Stream objWebStream = objWebResponse.GetResponseStream();

using (StreamReader objStreamReader = new StreamReader(objWebStream))
{ 
    csvValues = objStreamReader.ReadToEnd(); 
}

if (!(string.IsNullOrEmpty(csvValues)))
{
    Match coord = Regex.Match(csvValues, "<coordinates>.*</coordinates>");

    if (!coord.Success) return "";
        return coord.Value.Substring(13, coord.Length - 27); 
}

Does any one have a solution?

Error Details:

SOURCE : System

MESSAGE : The remote server returned an error: (403) Forbidden.

TARGETSITE : System.Net.WebResponse GetResponse()

STACKTRACE : at System.Net.HttpWebRequest.GetResponse() at 
             clsGetAreaLatLng.LocationGeoCode(String geoURL)
Posted
Updated 25-Nov-09 5:42am
v3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Can you tell me which URL you are trying for?
Actually AFAIK, google gives a javascript to draw the map.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100