远程服务器在System.Net.WebClient Client = new System.Net.WebClient();中返回错误Forbidden。使用(Stream strm = Client.OpenRead(url)) [英] The remote server returned an error Forbidden in System.Net.WebClient Client = new System.Net.WebClient(); using (Stream strm = Client.OpenRead(url))

查看:97
本文介绍了远程服务器在System.Net.WebClient Client = new System.Net.WebClient();中返回错误Forbidden。使用(Stream strm = Client.OpenRead(url))的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用类库实现Google地图API。

我有API密钥。但在我的类库中我收到错误,如远程服务器返回错误:(403)禁止@



System.Net.WebClient Client = new System.Net .WebClient();

使用(Stream strm = Client.OpenRead(url))

{

StreamReader sr = new StreamReader(strm) ;

result = sr.ReadToEnd();

}



请大家出来......!

解决方案

您使用的网址已过时!

查看它返回的错误:

 Geocoding API v2已于2013年9月9日被拒绝。现在应该使用Geocoding API v3。要了解详情,请访问https://developers.google.com/maps/documentation/geocoding/ 



前往并阅读有关如何使用新API的指示页面...


I am implementing the Google map API with a class library.
I have API key. but in my class libraryi am getting error like "The remote server returned an error: (403) Forbidden" @

System.Net.WebClient Client = new System.Net.WebClient();
using (Stream strm = Client.OpenRead(url))
{
StreamReader sr = new StreamReader(strm);
result = sr.ReadToEnd();
}

Please helo me out...!

解决方案

The URL you used is outdated!
See the error it returns:

The Geocoding API v2 has been turned down on September 9th, 2013. The Geocoding API v3 should be used now. Learn more at https://developers.google.com/maps/documentation/geocoding/


Go and read the indicated pages on how to use the new API...


这篇关于远程服务器在System.Net.WebClient Client = new System.Net.WebClient();中返回错误Forbidden。使用(Stream strm = Client.OpenRead(url))的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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