AddRange Method (Int32, Int32)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Adds a byte range header to the request for a specified range.
Namespace: System.Net
Assembly: System.Http (in System.Http.dll)
Syntax
'Declaration
Public Sub AddRange ( _
from As Integer, _
to As Integer _
)
public void AddRange(
int from,
int to
)
public:
void AddRange(
int from,
int to
)
member AddRange :
from:int *
to:int -> unit
public function AddRange(
from : int,
to : int
)
Parameters
- from
Type: System. . :: . .Int32
The position at which to start sending data.
- to
Type: System. . :: . .Int32
The position at which to stop sending data.
Remarks
The HttpWebRequest..::..AddRange method adds a byte range header to the request.
Since all HTTP entities are represented in HTTP messages as sequences of bytes, the concept of a byte range is meaningful for any HTTP entity. However, not all clients and servers need to support byte-range operations.
The Range header on a request allows a client to request that it only wants to receive some part of the specified range of bytes in an HTTP entity. Servers are not required to support Range header requests.
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=0-99\r\n\r\n
For this example, the from parameter would be specified as 0 and the to parameter would be specified as 99. The range specifier is automatically set as "bytes" by this method.
A HTTP server indicates support for Range headers with the Accept-Ranges header. An example of the Accept-Ranges header from a server that supports byte-ranges would be as follows:
Accept-Ranges: bytes\r\n\r\n
If an Accept-Ranges header is not received in the header of the response from the server, then the server does not support Range headers. An example of the Accept-Ranges header from a server that does not support ranges, but recognizes the Accept-Ranges header, would be as follows:
Accept-Ranges: none\r\n\r\n
When receiving the response from a range request, only the HTTP headers associated with the entire request are parsed and made available via properties on the HttpWebResponse class. Headers associated with each range are returned in the response.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.