WebClient 返回:如果没有给出代理则响应
我想使用 WebClient.UploadFile 上传文件,并且当
string proxyserver = "http://10.0.0.127:8080/";
IWebProxy proxy = new WebProxy(proxyserver);
proxy.Credentials = CredentialCache.DefaultCredentials;
WebClient Client = new WebClient();
Client.Headers.Add("UA-CPU", "x86");
Client.Headers.Add("Accept-Language", "en-us");
Client.Headers.Add("Cache-Control", "no-cache");
Client.Proxy = proxy;
byte[] rawResponse = Client.UploadFile(uri, filename);
string response = System.Text.Encoding.ASCII.GetString(rawResponse);
我收到远程服务器返回错误 403 Forbidden 时,如果我评论代理,我可以获得响应,但我在 fiddler 中看不到响应,不知道为什么?以及我如何使用代理来处理这个问题
I want to upload a file with WebClient.UploadFile and is as
string proxyserver = "http://10.0.0.127:8080/";
IWebProxy proxy = new WebProxy(proxyserver);
proxy.Credentials = CredentialCache.DefaultCredentials;
WebClient Client = new WebClient();
Client.Headers.Add("UA-CPU", "x86");
Client.Headers.Add("Accept-Language", "en-us");
Client.Headers.Add("Cache-Control", "no-cache");
Client.Proxy = proxy;
byte[] rawResponse = Client.UploadFile(uri, filename);
string response = System.Text.Encoding.ASCII.GetString(rawResponse);
I am getting remote server returned an error 403 Forbidden and if i comment the proxy i am able to get response, but i can't see response in fiddler, not knowing why? and also how can i work this with proxy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论