HttpWebRequest returns “ (403) Forbidden” Error

前端 未结 5 1532
醉酒成梦
醉酒成梦 2021-01-11 17:11

I wrote a xml grabber to receive/decode xml files from website. It works fine mostly but it always return error:

\"The remote server returned an e

5条回答
  •  死守一世寂寞
    2021-01-11 17:44

    Is your request going through a proxy server? If yes, add the following line before your GetResponse() call.

    webRequest.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
    

提交回复
热议问题