Add Method (HttpRequestHeader, String)
Collapse the table of content
Expand the table of content

WebHeaderCollection.Add Method (HttpRequestHeader, String)


Inserts the specified header with the specified value into the collection.

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

public void Add(
	HttpRequestHeader header,
	string value


Type: System.Net.HttpRequestHeader

The header to add to the collection.

Type: System.String

The content of the header.

Exception Condition

The length of value is greater than 65535.


This WebHeaderCollection instance does not allow instances of HttpRequestHeader.

If the specified header does not exist, the Add method inserts a new header into the list of header name/value pairs.

If the specified header is already present, value is added to the comma-separated list of values associated with the header.

.NET Framework
Available since 2.0
Return to top
© 2016 Microsoft