Share via


Headers Property

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

Gets or sets the collection of header name/value pairs returned by the server.

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

Syntax

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

Property Value

Type: System.Net. . :: . .WebHeaderCollection
A WebHeaderCollection instance that contains all the explicitly set HTTP headers to be included in the response.

Remarks

Response headers contain metadata information such as the date and time of the response, the identity of the responding server, and the MIME type of the data contained in the response body.

Note

If you attempt to set a Content-Length, Keep-Alive, Transfer-Encoding, or WWW-Authenticate header using the Headers property, an exception will be thrown. Use the KeepAlive or ContentLength64 properties to set these headers. You cannot set the Transfer-Encoding or WWW-Authenticate headers manually.

.NET Framework Security

See Also

Reference

HttpListenerResponse Class

System.Net Namespace