Share via


Headers Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Specifies a collection of the name/value pairs that make up the HTTP headers.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

Syntax

'Declaration
Public Overrides Property Headers As WebHeaderCollection
public override WebHeaderCollection Headers { get; set; }
public:
virtual property WebHeaderCollection^ Headers {
    WebHeaderCollection^ get () override;
    void set (WebHeaderCollection^ value) override;
}
abstract Headers : WebHeaderCollection with get, set
override Headers : WebHeaderCollection with get, set
override function get Headers () : WebHeaderCollection
override function set Headers (value : WebHeaderCollection)

Property Value

Type: System.Net. . :: . .WebHeaderCollection
A WebHeaderCollection that contains the name/value pairs that make up the headers for the HTTP request.

Remarks

The Headers collection contains the protocol headers associated with the request. The following table lists the HTTP headers that are not stored in the Headers collection but are either set by the system or set by properties or methods.

Header

Set by

Accept

Set by the Accept property.

Connection

Set by the Connection property and KeepAlive property.

Content-Length

Set by the ContentLength property.

Content-Type

Set by the ContentType property.

Expect

Set by the Expect property.

Date

Set by the Date property.

Host

Set by the Host property.

If-Modified-Since

Set by the IfModifiedSince property.

Range

Set by the AddRange method.

Referer

Set by the Referer property.

Transfer-Encoding

Set by the TransferEncoding property (the SendChunked property must be true).

User-Agent

Set by the UserAgent property.

.NET Framework Security

See Also

Reference

HttpWebRequest Class

System.Net Namespace