WebHeaderCollection.AddWithoutValidate(String, String) Method

Definition

Inserts a header into the collection without checking whether the header is on the restricted header list.

protected:
 void AddWithoutValidate(System::String ^ headerName, System::String ^ headerValue);
protected void AddWithoutValidate (string headerName, string? headerValue);
protected void AddWithoutValidate (string headerName, string headerValue);
member this.AddWithoutValidate : string * string -> unit
Protected Sub AddWithoutValidate (headerName As String, headerValue As String)

Parameters

headerName
String

The header to add to the collection.

headerValue
String

The content of the header.

Exceptions

headerName is null, Empty, or contains invalid characters.

-or-

headerValue contains invalid characters.

.NET Framework and .NET Core only: headerName is not null and the length of headerValue is too long (greater than 65,535 characters).

Remarks

The AddWithoutValidate method adds a header to the collection without checking whether the header is on the restricted header list.

Note

The length of headerValue is validated only in .NET Framework and .NET Core versions 2.0 - 3.1.

Notes to Inheritors

Use the AddWithoutValidate(String, String) method to add headers that are normally exposed through properties.

Applies to