[英]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.