WebHeaderCollection.Item[] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the specified header.
Overloads
Item[HttpRequestHeader] |
Gets or sets the specified request header. |
Item[HttpResponseHeader] |
Gets or sets the specified response header. |
Item[String] |
Item[HttpRequestHeader]
- Source:
- WebHeaderCollection.cs
- Source:
- WebHeaderCollection.cs
- Source:
- WebHeaderCollection.cs
Gets or sets the specified request header.
public:
property System::String ^ default[System::Net::HttpRequestHeader] { System::String ^ get(System::Net::HttpRequestHeader header); void set(System::Net::HttpRequestHeader header, System::String ^ value); };
public string this[System.Net.HttpRequestHeader header] { get; set; }
public string? this[System.Net.HttpRequestHeader header] { get; set; }
member this.Item(System.Net.HttpRequestHeader) : string with get, set
Default Public Property Item(header As HttpRequestHeader) As String
Parameters
- header
- HttpRequestHeader
The request header value.
Property Value
A String instance containing the specified header value.
Exceptions
This WebHeaderCollection instance does not allow instances of HttpRequestHeader.
Applies to
Item[HttpResponseHeader]
- Source:
- WebHeaderCollection.cs
- Source:
- WebHeaderCollection.cs
- Source:
- WebHeaderCollection.cs
Gets or sets the specified response header.
public:
property System::String ^ default[System::Net::HttpResponseHeader] { System::String ^ get(System::Net::HttpResponseHeader header); void set(System::Net::HttpResponseHeader header, System::String ^ value); };
public string this[System.Net.HttpResponseHeader header] { get; set; }
public string? this[System.Net.HttpResponseHeader header] { get; set; }
member this.Item(System.Net.HttpResponseHeader) : string with get, set
Default Public Property Item(header As HttpResponseHeader) As String
Parameters
- header
- HttpResponseHeader
The response header value.
Property Value
A String instance containing the specified header.
Exceptions
.NET Framework and .NET Core versions 2.0 - 3.1 only: The length of value
is greater than 65535.
This WebHeaderCollection instance does not allow instances of HttpResponseHeader.
Remarks
Note
The length of value
is validated only in .NET Framework and .NET Core versions 2.0 - 3.1.
- On all applicable .NET Framework versions: A WebHeaderCollection instance that's returned by the Headers property will throw an ArgumentOutOfRangeException if the length of
value
is greater than 65535. All other WebHeaderCollection instances accept avalue
of any length. - On .NET Core versions through version 3.1: A WebHeaderCollection instance used with any header of type HttpResponseHeader will throw an ArgumentOutOfRangeException if the length of
value
is greater than 65535. All other WebHeaderCollection instances accept avalue
of any length. - On .NET 5 and later versions: WebHeaderCollection accepts a
value
of any length.
Applies to
Item[String]
public:
property System::String ^ default[System::String ^] { System::String ^ get(System::String ^ name); void set(System::String ^ name, System::String ^ value); };
public string this[string name] { get; set; }
member this.Item(string) : string with get, set
Default Public Property Item(name As String) As String
Parameters
- name
- String