private AddRange ( string rangeSpecifier, string from, string to ) : bool | ||
rangeSpecifier | string | |
from | string | |
to | string | |
return | bool |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://example.com/file.txt"); request.AddRange(0, 99); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); // Read the first 100 bytes from the stream
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://example.com/file.txt"); request.AddRange(1000, 1999); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream stream = response.GetResponseStream(); // Read the bytes from 1000 to 1999 from the streamIn both examples, the AddRange method is called on the HttpWebRequest object, specifying the starting and ending byte range to download. The response from the server is then received and the stream is read to retrieve the required data. The HttpWebRequest class is part of the System.Net.Http package library.
private AddRange ( string rangeSpecifier, string from, string to ) : bool | ||
rangeSpecifier | string | |
from | string | |
to | string | |
return | bool |