这是this question上关于如何打开标题HttpWebRequest
的后续处理。如何关闭持久代理连接
我已经成功地从我的Web服务调用中禁用了Connection: Keep-Alive
标题,但是当我使用代理时,它还会在调用发送到服务器之前向代理发送CONNECT xxx.xxxxx.xx:443 HTTP/1.1
。
有了这个CONNECT
调用一系列的头被发送:
System.Net Information: 0 : [5420] ConnectStream#33166512 - Sending headers
{
Proxy-Authorization: Basic xxxxxxxxxxxxxxx==
Host: xxx.xxxxx.xx
Proxy-Connection: Keep-Alive
}.
我想摆脱Keep-Alive
和其更改为Close
但不能找出如何控制这个头。如何更改或禁用Proxy-Connection
标题?
编辑:
Googleing围绕我想,我必须设置webRequest.Connection = "Close";
或webRequest.Connection = null;
,但这些结果在参数异常。