Επεξεργασία

Κοινή χρήση μέσω


HttpWebRequest.AddRange Method

Definition

Adds a range header to the request.

Overloads

AddRange(Int32)

Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

AddRange(Int64)

Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

AddRange(Int32, Int32)

Adds a byte range header to the request for a specified range.

AddRange(Int64, Int64)

Adds a byte range header to the request for a specified range.

AddRange(String, Int32)

Adds a Range header to a request for a specific range from the beginning or end of the requested data.

AddRange(String, Int64)

Adds a Range header to a request for a specific range from the beginning or end of the requested data.

AddRange(String, Int32, Int32)

Adds a range header to a request for a specified range.

AddRange(String, Int64, Int64)

Adds a range header to a request for a specified range.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

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.

AddRange(Int32)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

public:
 void AddRange(int range);
public void AddRange (int range);
member this.AddRange : int -> unit
Public Sub AddRange (range As Integer)

Parameters

range
Int32

The starting or ending point of the range.

Exceptions

rangeSpecifier is invalid.

The range header could not be added.

Examples

The following code example adds a range header to the request.

// Create a New 'HttpWebRequest' object.
HttpWebRequest^ myHttpWebRequest1 = 
    (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
myHttpWebRequest1->AddRange( 1000);
Console::WriteLine("Call AddRange(1000)");
      Console::Write("Resulting Headers: ");
      Console::WriteLine(myHttpWebRequest1->Headers);

HttpWebRequest^ myHttpWebRequest2 = 
    (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
myHttpWebRequest2->AddRange(-1000);
Console::WriteLine("Call AddRange(-1000)");
      Console::Write("Resulting Headers: ");
      Console::WriteLine(myHttpWebRequest2->Headers);
// Create a New 'HttpWebRequest' object .
HttpWebRequest myHttpWebRequest1=(HttpWebRequest)WebRequest.Create("http://www.contoso.com");
myHttpWebRequest1.AddRange(1000);	
Console.WriteLine("Call AddRange(1000)");
Console.Write("Resulting Headers: ");
Console.WriteLine(myHttpWebRequest1.Headers.ToString());

// Create a New 'HttpWebRequest' object .
HttpWebRequest myHttpWebRequest2=(HttpWebRequest)WebRequest.Create("http://www.contoso.com");
myHttpWebRequest2.AddRange(-1000);	
Console.WriteLine("Call AddRange(-1000)");
Console.Write("Resulting Headers: ");
Console.WriteLine(myHttpWebRequest2.Headers.ToString());
' A New 'HttpWebRequest' object is created.
Dim myHttpWebRequest1 As HttpWebRequest = WebRequest.Create("http://www.contoso.com")
myHttpWebRequest1.AddRange(1000)
Console.WriteLine("Call AddRange(1000)")
      Console.Write("Resulting Headers: ")
      Console.WriteLine(myHttpWebRequest1.Headers.ToString())

Dim myHttpWebRequest2 As HttpWebRequest = WebRequest.Create("http://www.contoso.com")
myHttpWebRequest2.AddRange(-1000)
Console.WriteLine("Call AddRange(-1000)")
      Console.Write("Resulting Headers: ")
      Console.WriteLine(myHttpWebRequest2.Headers.ToString())

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a byte range header to the request.

If range is positive, the range parameter specifies the starting point of the range. The server should start sending data from the range parameter specified to the end of the data in the HTTP entity.

If range is negative, the range parameter specifies the ending point of the range. The server should start sending data from the start of the data in the HTTP entity to the range parameter specified.

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 server send the first 100 bytes (from the start to byte position 99) would be the following:

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

For this example, the range parameter would be -99.

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.

See also

Applies to

AddRange(Int64)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

public:
 void AddRange(long range);
public void AddRange (long range);
member this.AddRange : int64 -> unit
Public Sub AddRange (range As Long)

Parameters

range
Int64

The starting or ending point of the range.

Exceptions

rangeSpecifier is invalid.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a byte range header to the request.

If range is positive, the range parameter specifies the starting point of the range. The server should start sending data from the range parameter specified to the end of the data in the HTTP entity.

If range is negative, the range parameter specifies the ending point of the range. The server should start sending data from the start of the data in the HTTP entity to the range parameter specified.

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 server send the first 100 bytes (from the start to byte position 99) would be the following:

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

For this example, the range parameter would be -99.

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.

See also

Applies to

AddRange(Int32, Int32)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a byte range header to the request for a specified range.

public:
 void AddRange(int from, int to);
public void AddRange (int from, int to);
member this.AddRange : int * int -> unit
Public Sub AddRange (from As Integer, to As Integer)

Parameters

from
Int32

The position at which to start sending data.

to
Int32

The position at which to stop sending data.

Exceptions

rangeSpecifier is invalid.

from is greater than to

-or-

from or to is less than 0.

The range header could not be added.

Examples

The following code example adds a range header to the request.

// Create a New 'HttpWebRequest' object.
HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) );
myHttpWebRequest->AddRange( 50, 150 );
Console::WriteLine("Call AddRange(50, 150)");
      Console::Write("Resulting Request Headers: ");
      Console::WriteLine(myHttpWebRequest->Headers);

// Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() );

// Displays the headers in the response received
Console::Write("Resulting Response Headers: ");
      Console::WriteLine(myHttpWebResponse->Headers);

// Display the contents of the page to the console.
Stream^ streamResponse = myHttpWebResponse->GetResponseStream();
StreamReader^ streamRead = gcnew StreamReader( streamResponse );
array<Char>^ readBuffer = gcnew array<Char>(256);
int count = streamRead->Read( readBuffer, 0, 256 );
Console::WriteLine( "\nThe HTML contents of the page from 50th to 150 charaters are :\n  " );
while ( count > 0 )
{
   String^ outputData = gcnew String( readBuffer,0,count );
   Console::WriteLine( outputData );
   count = streamRead->Read( readBuffer, 0, 256 );
}
streamRead->Close();
streamResponse->Close();
myHttpWebResponse->Close();
      // Create a New 'HttpWebRequest' object .
      HttpWebRequest myHttpWebRequest=(HttpWebRequest)WebRequest.Create("http://www.contoso.com");
      myHttpWebRequest.AddRange(50,150);	
      Console.WriteLine("Call AddRange(50,150)");
      Console.Write("Resulting Request Headers: ");
      Console.WriteLine(myHttpWebRequest.Headers.ToString());

      // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
      HttpWebResponse myHttpWebResponse=(HttpWebResponse)myHttpWebRequest.GetResponse();

// Displays the headers in the response received
Console.Write("Resulting Response Headers: ");
      Console.WriteLine(myHttpWebResponse.Headers.ToString());

      // Display the contents of the page to the console.
      Stream streamResponse=myHttpWebResponse.GetResponseStream();
      StreamReader streamRead = new StreamReader( streamResponse );
      Char[] readBuffer = new Char[256];
      int count = streamRead.Read( readBuffer, 0, 256 );
      Console.WriteLine("\nThe HTML contents of the page from 50th to 150 characters are :\n  ");	
      while (count > 0)
      {
          String outputData = new String(readBuffer, 0, count);
          Console.WriteLine(outputData);
          count = streamRead.Read(readBuffer, 0, 256);
      }
      // Release the response object resources.
      streamRead.Close();
      streamResponse.Close();
      myHttpWebResponse.Close();
' A New 'HttpWebRequest' objetc is created.
Dim myHttpWebRequest As HttpWebRequest = WebRequest.Create("http://www.contoso.com")
myHttpWebRequest.AddRange(50, 150)
Console.WriteLine("Call AddRange(50, 150)")
      Console.Write("Resulting Request Headers: ")
      Console.WriteLine(myHttpWebRequest.Headers.ToString())

' The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable.
Dim myHttpWebResponse As HttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)

' Displays the headers in the response received
Console.Write("Resulting Response Headers: ")
      Console.WriteLine(myHttpWebResponse.Headers.ToString())

' Displaying the contents of the page to the console
Dim streamResponse As Stream = myHttpWebResponse.GetResponseStream()
Dim streamRead As New StreamReader(streamResponse)
Dim readBuffer(256) As [Char]
Dim count As Integer = streamRead.Read(readBuffer, 0, 256)
Console.WriteLine(ControlChars.Cr + "The HTML contents of the page from 50th to 150 charaters are :" + ControlChars.Cr + "  ")
While count > 0
    Dim outputData As New [String](readBuffer, 0, count)
    Console.WriteLine(outputData)
    count = streamRead.Read(readBuffer, 0, 256)
End While
' Release the response object resources.
 streamRead.Close()
 streamResponse.Close()
myHttpWebResponse.Close()

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

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.

See also

Applies to

AddRange(Int64, Int64)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a byte range header to the request for a specified range.

public:
 void AddRange(long from, long to);
public void AddRange (long from, long to);
member this.AddRange : int64 * int64 -> unit
Public Sub AddRange (from As Long, to As Long)

Parameters

from
Int64

The position at which to start sending data.

to
Int64

The position at which to stop sending data.

Exceptions

rangeSpecifier is invalid.

from is greater than to

-or-

from or to is less than 0.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

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.

See also

Applies to

AddRange(String, Int32)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a Range header to a request for a specific range from the beginning or end of the requested data.

public:
 void AddRange(System::String ^ rangeSpecifier, int range);
public void AddRange (string rangeSpecifier, int range);
member this.AddRange : string * int -> unit
Public Sub AddRange (rangeSpecifier As String, range As Integer)

Parameters

rangeSpecifier
String

The description of the range.

range
Int32

The starting or ending point of the range.

Exceptions

rangeSpecifier is null.

rangeSpecifier is invalid.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a Range header to the request.

If range is positive, the range parameter specifies the starting point of the range. The server should start sending data from the range parameter specified to the end of the data in the HTTP entity.

If range is negative, the range parameter specifies the ending point of the range. The server should start sending data from the start of the data in the HTTP entity to the range parameter specified.

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.

The rangeSpecifier parameter would normally be specified as a "bytes", since this is the only range specifier recognized by most HTTP servers. Setting the rangeSpecifier parameter to some other string allows support for custom range specifiers other than bytes (the byte-range specifier defined in RFC 2616 by the IETF).

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.

A HTTP server indicates support for Range headers with the Accept-Ranges header in the response. 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.

See also

Applies to

AddRange(String, Int64)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a Range header to a request for a specific range from the beginning or end of the requested data.

public:
 void AddRange(System::String ^ rangeSpecifier, long range);
public void AddRange (string rangeSpecifier, long range);
member this.AddRange : string * int64 -> unit
Public Sub AddRange (rangeSpecifier As String, range As Long)

Parameters

rangeSpecifier
String

The description of the range.

range
Int64

The starting or ending point of the range.

Exceptions

rangeSpecifier is null.

rangeSpecifier is invalid.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a Range header to the request.

If range is positive, the range parameter specifies the starting point of the range. The server should start sending data from the range parameter specified to the end of the data in the HTTP entity.

If range is negative, the range parameter specifies the ending point of the range. The server should start sending data from the start of the data in the HTTP entity to the range parameter specified.

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.

The rangeSpecifier parameter would normally be specified as a "bytes", since this is the only range specifier recognized by most HTTP servers. Setting the rangeSpecifier parameter to some other string allows support for custom range specifiers other than bytes (the byte-range specifier defined in RFC 2616 by the IETF).

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.

A HTTP server indicates support for Range headers with the Accept-Ranges header in the response. 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.

See also

Applies to

AddRange(String, Int32, Int32)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a range header to a request for a specified range.

public:
 void AddRange(System::String ^ rangeSpecifier, int from, int to);
public void AddRange (string rangeSpecifier, int from, int to);
member this.AddRange : string * int * int -> unit
Public Sub AddRange (rangeSpecifier As String, from As Integer, to As Integer)

Parameters

rangeSpecifier
String

The description of the range.

from
Int32

The position at which to start sending data.

to
Int32

The position at which to stop sending data.

Exceptions

rangeSpecifier is null.

from is greater than to

-or-

from or to is less than 0.

rangeSpecifier is invalid.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a 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.

The rangeSpecifier parameter would normally be specified as a "bytes", since this is the only range specifier recognized by most HTTP servers. Setting the rangeSpecifier parameter to some other string allows support for custom range specifiers other than bytes (the byte-range specifier defined in RFC 2616 by the IETF).

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 rangeSpecifier parameter would be specified as a "bytes", the from parameter would be 0, and the to parameter would be 99.

A HTTP server indicates support for Range headers with the Accept-Ranges header in the response. 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

The string specified in the Accept-Ranges header is the range-specifier that would be by specified in the rangeSpecifier parameter for this method.

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.

See also

Applies to

AddRange(String, Int64, Int64)

Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs
Source:
HttpWebRequest.cs

Adds a range header to a request for a specified range.

public:
 void AddRange(System::String ^ rangeSpecifier, long from, long to);
public void AddRange (string rangeSpecifier, long from, long to);
member this.AddRange : string * int64 * int64 -> unit
Public Sub AddRange (rangeSpecifier As String, from As Long, to As Long)

Parameters

rangeSpecifier
String

The description of the range.

from
Int64

The position at which to start sending data.

to
Int64

The position at which to stop sending data.

Exceptions

rangeSpecifier is null.

from is greater than to

-or-

from or to is less than 0.

rangeSpecifier is invalid.

The range header could not be added.

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The HttpWebRequest.AddRange method adds a 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.

The rangeSpecifier parameter would normally be specified as a "bytes", since this is the only range specifier recognized by most HTTP servers. Setting the rangeSpecifier parameter to some other string allows support for custom range specifiers other than bytes (the byte-range specifier defined in RFC 2616 by the IETF).

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 rangeSpecifier parameter would be specified as a "bytes", the from parameter would be 0, and the to parameter would be 99.

A HTTP server indicates support for Range headers with the Accept-Ranges header in the response. 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

The string specified in the Accept-Ranges header is the range-specifier that would be by specified in the rangeSpecifier parameter for this method.

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.

See also

Applies to