【问题标题】:System.Net.WebException: The remote server returned an error: (403) Forbidden when access Google APISystem.Net.WebException:远程服务器返回错误:(403) 访问 Google API 时禁止访问
【发布时间】:2012-08-23 16:36:02
【问题描述】:

我在我的网站上使用 Google API。有用 从我的本地主机很好,但在实时服务器上我得到以下 错误:

System.Net.WebException: The remote server returned an error: (403)
Forbidden.
at System.Net.HttpWebRequest.GetResponse()
at GoogleUrlShortnerApi.Shorten(String url)

我正在使用此处找到的代码: http://www.thecyberwizard.com/index.php/5/google-analytics-api-in-c-part-1/

从调试中,我看到错误发生在

HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();

命令。

有谁知道可能导致错误的原因(同样,错误 只发生在服务器上。当我在本地运行此代码时 计算机,它运行良好并检索一个短网址)。

我必须关闭结算仍然得到以下信息 错误:

System.Net.WebException: The remote server returned an error: (403)  

我该如何解决这个问题?

【问题讨论】:

    标签: c# asp.net c api google-maps-api-3


    【解决方案1】:

    通过将 _autoPostData 值更改为 "â?accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=analytics&source=thecyberwizard.comâ" 来工作。

    【讨论】:

      猜你喜欢
      • 2019-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多