Gets or sets the collection of HTTP header name/value pairs associated with the current instance.
A System.Net.WebHeaderCollection containing the name/value pairs of the headers for the current instance.
Type Reason InvalidOperationException A set operation was requested but data has already been written to the request data stream.
The following table lists the HTTP headers that cannot be set using the collection returned by this property.
Header Set by Accept HttpWebRequest.Accept . Connection Content-Length HttpWebRequest.ContentLength. Content-Type HttpWebRequest.ContentType. Expect HttpWebRequest.Expect. Date Set by the system to the current date. Host Set by the system to the current host information. Range HttpWebRequest.AddRange(int, int) . Referer HttpWebRequest.Referer. Transfer-Encoding User-Agent HttpWebRequest.UserAgent. Note: This property overrides WebRequest.Headers.
Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0