Mega Code Archive

 
Categories / C# / Network
 

Web Client Response Headers Test

using System; using System.Collections.Specialized; using System.Net; public class ResponseHeadersTest {    public static void Main(string[] argv)    {       WebClient wc = new WebClient();       byte[] response = wc.DownloadData(argv[0]);       WebHeaderCollection whc = wc.ResponseHeaders;       Console.WriteLine("header count = {0}", whc.Count);       for (int i = 0; i < whc.Count; i++)       {          Console.WriteLine(whc.GetKey(i) + " = " + whc.Get(i));       }    } }