WebHeaderCollection.Remove Method (String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Removes the specified header from the collection.

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

override Remove : 
        name:string -> unit


Type: System.String

The name of the header to remove from the collection.

Exception Condition

name is nullEmpty.


name is a restricted header.


name contains invalid characters.

Remove deletes the specified header from the collection. If the specified header does not exist, the method returns.

The following example uses the Remove method to remove a header from the WebHeaderCollection. After the header is removed, this example prints all existing headers to the screen to prove that it has been removed.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top