我有一个"http://mt0.google.com/vt/lyrs=m@129&hl=en&x=11728&y=7595&z=14&s=Galileo"
用于从 Internet 获取 Google Tiles 的 URL。如果我从浏览器(任何)使用这个 Google Tile URL,我成功地获得了 Google Tiles(地图)。但问题是,如果我尝试以编程方式访问此 URL,我会收到 Error: HTTP 403 Forbidden Error。
可能是什么问题呢?我需要在我的程序中进行某种设置吗?
我访问 URL 的代码如下:
byte[] imageBuffer = null;
try
{
WebClient client = new WebClient();
// It's a sample URL to get Tile from Google as on 29-06-2010
string url = "http://mt0.google.com/vt/lyrs=m@129&hl=en&x=11728&y=7595&z=14&s=Galileo";
imageBuffer = client.DownloadData(new Uri(url));
}
catch (WebException we)
{
Debug.Print(we.Message);
return null;
}
return imageBuffer;
在这里,在 catch 块中,我得到一个HTTP 403 异常:禁止错误