WebClient autentification错误 [英] WebClient autentification error
本文介绍了WebClient autentification错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我需要通过代理服务器连接到http服务器。代理服务器需要NTLM autentification。我使用类WebClient作为传输。我在构建 WebProxy 类时设置了代理信息(URL +凭据)。
I need connect to http server via proxy server. Proxy server needs NTLM autentification. I use class WebClient as transport. I set up proxy information (URL+credentials) while I construct WebProxy class.
当我向某个站点发送查询时,代理服务器出错(407.需要代理身份验证) 。我用Ethereal程序查看了捕获并看到了标题"Proxy-connection:Keep Alive"没有被发送到代理。如您所知,如果没有此标头,某些代理服务器将无法运行。
当我尝试手动设置此标题时(WebClient.Headers.Add方法),方法抛出错误"必须使用适当的属性修改此标头。参数名称:name"。
我该怎么做才能避免这个错误?
推荐答案
HttpWebRequest请求;
HttpWebRequest request;
...
request.KeepAlive = true;
request.KeepAlive = true;
这篇关于WebClient autentification错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文