Mono Class Library: System.Net.HttpWebRequest Overview | Members

System.Net.HttpWebRequest.Headers Property

Gets or sets the collection of HTTP header name/value pairs associated with the current instance. [Edit]

public override WebHeaderCollection Headers { set; get; }

Value

A System.Net.WebHeaderCollection containing the name/value pairs of the headers for the current instance. [Edit]

Exceptions

TypeReason
InvalidOperationExceptionA set operation was requested but data has already been written to the request data stream. [Edit]

Remarks

The following table lists the HTTP headers that cannot be set using the collection returned by this property.

HeaderSet by
AcceptHttpWebRequest.Accept .
Connection

HttpWebRequest.Connection .

HttpWebRequest.KeepAlive.

Content-LengthHttpWebRequest.ContentLength.
Content-TypeHttpWebRequest.ContentType.
ExpectHttpWebRequest.Expect.
DateSet by the system to the current date.
HostSet by the system to the current host information.
RangeHttpWebRequest.AddRange(int, int) .
RefererHttpWebRequest.Referer.
Transfer-Encoding

HttpWebRequest.TransferEncoding.

HttpWebRequest.SendChunked.

User-AgentHttpWebRequest.UserAgent.

Note: This property overrides WebRequest.Headers.

[Edit]

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0