Networking
System
[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]
1.0.x.x
1.0.5000.0
2.0.0.0
4.0.0.0
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
System.Collections.Specialized.NameValueCollection
System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices.ComVisible(true)
The class is generally accessed through or . Some common headers are considered restricted and are either exposed directly by the API (such as Content-Type) or protected by the system and cannot be changed.
The restricted headers are:
-
Accept
-
Connection
-
Content-Length
-
Content-Type
-
Date
-
Expect
-
Host
-
If-Modified-Since
-
Range
-
Referer
-
Transfer-Encoding
-
User-Agent
-
Proxy-Connection
Contains protocol headers associated with a request or response.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
Initializes a new instance of the class.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
This constructor implements the interface for the class.
Initializes a new instance of the class from the specified instances of the and classes.
A containing the information required to serialize the .
A containing the source of the serialized stream associated with the new .
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
is or .
does not contain a colon (:) character.
-or-
name is , or contains invalid characters.
-or-
is a protected header that can only be set with a property accessor or by the system.
-or-
value contains invalid characters.
The parameter must be specified in the format "name:value". If the specified header does not exist in the collection, a new header is added to the collection.
If the header specified in is already present in the collection, the value part of the is concatenated with the existing value.
Inserts the specified header into the collection.
The header to add, with the name and value separated by a colon.
0
Method
2.0.0.0
4.0.0.0
System.Void
If the specified header does not exist, the method inserts a new header into the list of header name/value pairs.
If the specified header is already present, is added to the comma-separated list of values associated with the header.
Inserts the specified header with the specified value into the collection.
The header to add to the collection.
The content of the header.
Method
2.0.0.0
4.0.0.0
System.Void
If the specified header does not exist, the method inserts a new header into the list of header name/value pairs.
If the specified header is already present, is added to the comma-separated list of values associated with the header.
Inserts the specified header with the specified value into the collection.
The header to add to the collection.
The content of the header.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
is or , or contains invalid characters.
-or-
is a protected header that can only be set with a property accessor or by the system.
-or-
contains invalid characters.
If the header specified in does not exist, the method inserts a new header into the list of header name/value pairs.
If the header specified in is already present, is added to the existing comma-separated list of values associated with .
Inserts a header with the specified name and value into the collection.
The header to add to the collection.
The content of the header.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
is or , or contains invalid characters.
-or-
contains invalid characters.
The method adds a header to the collection without checking whether the header is on the restricted header list.
Inserts a header into the collection without checking whether the header is on the restricted header list.
The header to add to the collection.
The content of the header.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String[]
To be added.
To be added.
Gets all header names (keys) in the collection.
Method
2.0.0.0
4.0.0.0
System.Void
To be added.
Removes all headers from the collection.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Int32
To be added.
To be added.
Gets the number of headers in the collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
Get the value of a particular header in the collection, specified by an index into the collection.
A containing the value of the specified header.
The zero-based index of the key to get from the collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
This method returns null if there is no header in the collection.
Get the value of a particular header in the collection, specified by the name of the header.
A holding the value of the specified header.
The name of the Web header.
Method
2.0.0.0
4.0.0.0
System.Collections.IEnumerator
To be added.
Returns an enumerator that can iterate through the instance.
An for the .
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
Get the header name at the specified position in the collection.
A holding the header name.
The zero-based index of the key to get from the collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
Any objects included in the are automatically tracked and serialized by the formatter.
Populates a with the data needed to serialize the target object.
The to populate with data.
A that specifies the destination for this serialization.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String[]
returns the contents of the specified header as an array.
Gets an array of header values stored in the position of the header collection.
An array of header strings.
The header index to return.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String[]
This example demonstrates the method.
using System;
using System.Net;
class GetValuesExample
{
public static void Main()
{
Uri contosoUri = new Uri("http://www.contoso.com");
HttpWebRequest httpContoso =
(HttpWebRequest)WebRequest.Create(contosoUri);
httpContoso.SendChunked=true;
httpContoso.TransferEncoding="compress";
httpContoso.TransferEncoding="gzip";
WebHeaderCollection webColl = httpContoso.Headers;
String[] sAry = webColl.GetValues("Transfer-Encoding");
Console.WriteLine("Transfer-Encoding:");
foreach(string s in sAry)
Console.WriteLine("{0}", s);
}
}
The output is
Transfer-Encoding:
compress
gzip
returns the contents of the specified header as an array.
Gets an array of header values stored in a header.
An array of header strings.
The header to return.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Boolean
is or .
contains invalid characters.
The 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
Tests whether the specified HTTP header can be set for the request.
true if the header is restricted; otherwise false.
The header to test.
0
Method
2.0.0.0
4.0.0.0
System.Boolean
The 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
Tests whether the specified HTTP header can be set for the request or the response.
true if the header is restricted; otherwise, false.
The header to test.
Does the Framework test the response or the request?
Property
2.0.0.0
4.0.0.0
System.String
To be added.
To be added.
To be added.
To be added.
Property
2.0.0.0
4.0.0.0
System.String
To be added.
To be added.
To be added.
To be added.
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Collections.Specialized.NameObjectCollectionBase+KeysCollection
To be added.
To be added.
Gets the collection of header names (keys) in the collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
To be added.
Implements the interface and raises the deserialization event when the deserialization is complete.
The source of the deserialization event.
Method
2.0.0.0
4.0.0.0
System.Void
deletes the specified header from the collection. If the specified header does not exist, the method does nothing.
Removes the specified header from the collection.
The instance to remove from the collection.
Method
2.0.0.0
4.0.0.0
System.Void
deletes the specified header from the collection. If the specified header does not exist, the method does nothing.
Removes the specified header from the collection.
The instance to remove from the collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
is or .
contains invalid characters.
-or-
is a protected header that can only be set with a property accessor or by the system.
deletes the specified header from the collection. If the specified header does not exist, the method returns.
Removes the specified header from the collection.
The name of the header to remove from the collection.
0
Method
2.0.0.0
4.0.0.0
System.Void
If the header specified in the header does not exist, the method inserts a new header into the list of header name/value pairs.
If the header specified in is already present, replaces the existing value.
Sets the specified header to the specified value.
The value to set.
The content of the header to set.
Method
2.0.0.0
4.0.0.0
System.Void
If the header specified in the header does not exist, the method inserts a new header into the list of header name/value pairs.
If the header specified in is already present, replaces the existing value.
Sets the specified header to the specified value.
The value to set.
The content of the header to set.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
is or .
contains invalid characters.
-or-
is a protected header that can only be set with a property accessor or by the system.
-or-
contains invalid characters.
If the header specified in the header does not exist, the method inserts a new header into the list of header name/value pairs.
If the header specified in is already present, replaces the existing value.
Sets the specified header to the specified value.
The header to set.
The content of the header to set.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
To be added.
Serializes this instance into the specified object.
The object into which this will be serialized.
The destination of the serialization.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Byte[]
To be added.
Converts the to a byte array..
A array holding the header collection.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.String
To be added.
This method is obsolete.
The representation of the collection.
0