System.Net.WebHeaderCollection.IsRestricted Method

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

Syntax

public static bool IsRestricted (string headerName, bool response)

Parameters

headerName
The header to test.
response
Does the Framework test the response or the request?

Returns

true if the header is restricted; otherwise, false.

Remarks

The WebHeaderCollection.IsRestricted(string, bool) method returns true to indicate that a request or response 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: 2.0.0.0, 4.0.0.0