Mega Code Archive

 
Categories / C# Tutorial / Network
 

Response Headers

using System; using System.Collections.Specialized; using System.Net; class MainClass {    public static void Main(string[] argv)    {       WebClient wc = new WebClient();       byte[] response = wc.DownloadData("http://www.jva2s.com");       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));       }    } }