![]()
An array of header strings.
WebHeaderCollection.GetValues(string) returns the contents of the specified header as an array.
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