简体   繁体   English

通过HTTPS使用WebClient发送请求 - POST日期加倍

[英]Sending request using WebClient by HTTPS - POST date doubles

This code 这段代码

        using (WebClient webClient = new WebClient())
        {
            string address = "https://www.any.com/name.htm";
            byte[] postData = Encoding.ASCII.GetBytes("login=123");
            webClient.Headers[HttpRequestHeader.Accept] = "text/html, application/xhtml+xml, */*";
            webClient.Headers[HttpRequestHeader.AcceptLanguage] = "ru-RU";
            webClient.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
            webClient.Headers[HttpRequestHeader.AcceptEncoding] = "gzip, deflate";
            webClient.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            webClient.UploadData(address, postData);
        }

produces this request (postData doubles): 产生这个请求(postData加倍):

POST /name.htm HTTP/1.1
Accept-Language: ru-RU
Accept-Encoding: gzip, deflate
Accept: text/html, application/xhtml+xml, */*
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Host: [url]www.any.com[/url]
Content-Length: 9
Connection: Keep-Alive

login=123login=123

If I change 如果我改变

string address = "https://www.any.com/name.htm"

to

string address = "http://www.any.com/name.htm"

then data don't doubles. 然后数据不会加倍。

How avoid data doubling when send request by HTTPS ? 如何通过HTTPS发送请求时避免数据加倍?

It is bug of HttpAnalizer. 这是HttpAnalizer的错误。

Many thanks to Hardrada. 非常感谢Hardrada。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM