且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Web客户端下载C#分块编码的内容

更新时间:2022-05-27 01:57:05

我还没有尝试过,但是这可能工作:

I haven't tried it but this might work:

如果您强制发送一个请求HTTP 1.0而不是HTTP 1.1,然后服务器将用
HTTP标头指定的Content-Length回复

If you forcefully send an request for Http 1.0 rather than Http 1.1 then server will reply with HTTP Header specifying Content-Length

HttpWebRequest wr = (HttpWebRequest)WebRequest.Create("http://localhost/audiotest/audio.wav");
wr.ProtocolVersion = Version.Parse("1.0"); 

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

您将获得 response.GetResponseStream的文件流()

所有信贷的这个