How to specify range >2GB for HttpWebRequest in .NET 3.5

前端 未结 4 909
北荒
北荒 2021-01-14 16:23

I\'m building this class to download files in parts/sections/segments. In .NET 4.0, I can use this code to specify the range to download from

long startPos =         


        
4条回答
  •  攒了一身酷
    2021-01-14 16:52

    I believe the documentation gives some insight into that:

    An example of a Range header in an HTTP protocol request that requests the first 100 bytes would be would be the following:

    Range: bytes=-99\r\n\r\n
    

    For this example, the rangeSpecifier parameter would be specified as "bytes" and the range parameter would be -99.

    Then there is also this from Wikipedia:

    Range
    Request only part of an entity. Bytes are numbered from 0.
    Range: bytes=500-999
    

    So the code that you would result on the example above is

    HttpWebRequest.AddRange("bytes", 500, 999);
    

提交回复
热议问题