![](/img/trans.png)
[英]System.Net.WebException: The remote server returned an error: (403) Forbidden
[英]System.Net.WebException: The remote server returned an error: (403) Forbidden when access Google API
我在我的網站上使用Google API。 它從我的localhost工作正常,但在實時服務器上我收到以下錯誤:
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();
命令。
有誰知道可能導致錯誤的原因(同樣,錯誤只發生在服務器上。當我在我的計算機上本地運行此代碼時,它運行正常並檢索一個簡短的URL)。
我必須關閉結算仍然會收到以下錯誤:
System.Net.WebException: The remote server returned an error: (403)
我該如何解決這個問題?
它的工作原理是將_autoPostData值更改為"â?accountType=HOSTED_OR_GOOGLE&Email={0}&Passwd={1}&service=analytics&source=thecyberwizard.comâ"
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.