System.Net.WebHeaderCollection.IsRestricted Method

Tests whether the specified HTTP header can be set for the request.

Syntax

public static bool IsRestricted (string headerName)

Parameters

headerName
The header to test.

Returns

true if the header is restricted; otherwise false.

Exceptions

TypeReason
ArgumentNullException headerName is null or string.Empty.
ArgumentException headerName contains invalid characters.

Remarks

The WebHeaderCollection.IsRestricted(string) method returns true to indicate that a header is restricted and must be set using properties instead of directly or is set by the system. The restricted headers are:

  • Accept

  • Connection

  • Content-Length

  • Content-Type

  • Date

  • Expect

  • Host

  • If-Modified-Since

  • Range

  • Referer

  • Transfer-Encoding

  • User-Agent

  • Proxy-Connection

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0