远程服务器返回错误:(403)禁止.使用Google Map API [英] The remote server returned an error: (403) Forbidden. With Google Map API

查看:155
本文介绍了远程服务器返回错误:(403)禁止.使用Google Map API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我面临一个非常特殊的问题,我正在将google maps API用于网页.

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

"THE REMOTE SERVER RETURNED AN ERROR - 403 FORBIDDEN"

有时候它确实可以正常工作(但是在我的本地系统上,它总是可以工作).

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

我正在使用以下代码从Google API获取参考(即经度,纬度)

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); 
}

有人可以解决吗?

错误详细信息:

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)

推荐答案

您能告诉我您要使用哪个URL吗?
实际上是AFAIK,谷歌提供了一个JavaScript来绘制地图.
Can you tell me which URL you are trying for?
Actually AFAIK, google gives a javascript to draw the map.


这篇关于远程服务器返回错误:(403)禁止.使用Google Map API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆