简体   繁体   English

System.Net.WebException:远程服务器返回错误:(403)访问Google API时禁止访问

[英]System.Net.WebException: The remote server returned an error: (403) Forbidden when access Google API

I'm using the Google API on my website. 我在我的网站上使用Google API。 It works fine from my localhost, but on the live server I get the following error: 它从我的localhost工作正常,但在实时服务器上我收到以下错误:

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

I'm using the code found here: http://www.thecyberwizard.com/index.php/5/google-analytics-api-in-c-part-1/ 我正在使用此处的代码: http//www.thecyberwizard.com/index.php/5/google-analytics-api-in-c-part-1/

And from debugging, I see that the error occurs on the 从调试,我看到错误发生在

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

command. 命令。

Does anyone know what could be causing the error (again, the error happens only on the server. When I run this code locally on my computer, it runs fine and retrieves a short url). 有谁知道可能导致错误的原因(同样,错误只发生在服务器上。当我在我的计算机上本地运行此代码时,它运行正常并检索一个简短的URL)。

I have to turn off billing still I get the following error: 我必须关闭结算仍然会收到以下错误:

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

How can I resolve this? 我该如何解决这个问题?

它的工作原理是将_autoPostData值更改为"â?accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=analytics&source=thecyberwizard.comâ"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 System.Net.WebException:远程服务器返回错误:(403)禁止 - System.Net.WebException: The remote server returned an error: (403) Forbidden System.Net.WebException:远程服务器返回错误:(403)禁止 - System.Net.WebException : The remote server returned an error: (403) Forbidden 获取System.Net.WebException:远程服务器返回错误:(403)Forbidden。在Google URL Shortener API Call中 - Getting System.Net.WebException: The remote server returned an error: (403) Forbidden. in Google URL Shortener API Call 无法获取Web HTML代码:System.Net.WebException:'远程服务器返回错误:(403)禁止。 - Can't get web html code: System.Net.WebException: 'The remote server returned an error: (403) Forbidden. System.Net.WebException:'远程服务器返回错误:(400)错误的请求。 尝试从Google服务器下载数据时 - System.Net.WebException: 'The remote server returned an error: (400) Bad Request.' when trying to download data from google server 访问api时出现System.Net.WebException - System.Net.WebException when access api System.Net.WebException:远程服务器返回错误:(401)未经授权。 在System.Net.HttpWebRequest.GetResponse() - System.Net.WebException: The remote server returned an error: (401) Unauthorized. at System.Net.HttpWebRequest.GetResponse() System.Net.WebException:远程服务器返回错误:(400)错误请求。 c# API登录winform - System.Net.WebException: The remote server returned an error: (400) Bad Request. c# API login winform System.Net.WebException:远程服务器返回错误:(500)内部服务器错误。 - System.Net.WebException: The remote server returned an error: (500) Internal Server Error. 修复 - System.Net.WebException:远程服务器返回错误:(500) 语法错误,命令无法识别 - Fixing - System.Net.WebException: The remote server returned an error: (500) Syntax error, command unrecognized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM