Returns the values stored in the specified protocol header.
- header
- A string containing the protocol header name whose values are returned.
An array of string objects that contain the values of the protocol header named header in the current instance. If header is not found in the current instance, returns null .
Note: This method overrides System.Collections.Specialized.NameValueCollection.GetValues(string).
This example demonstrates the WebHeaderCollection.GetValues(string) method.
C# Example
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
Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0