Click here to Skip to main content
16,021,417 members
Please Sign up or sign in to vote.
1.67/5 (2 votes)

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)

C#
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

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900