using System;
using System.Net;
public class HeaderDemo {
public static void Main() {
HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://www.osborne.com");
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
string[] names = resp.Headers.AllKeys;
Console.WriteLine("{0,-20}{1}\n", "Name", "Value");
foreach(string n in names)
Console.WriteLine("{0,-20}{1}", n, resp.Headers[n]);
resp.Close();
}
}
|