using System;
using System.Net;
class MainClass {
public static void Main() {
HttpWebRequest req = (HttpWebRequest) WebRequest.Create("http://www.navioo.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();
}
}
Output
Name Value
Connection close
Accept-Ranges bytes
Content-Length 341387
Content-Type text/html
Date Sun, 25 Mar 2007 21:06:43 GMT
ETag "14904bc-5358b-bce5400"
Last-Modified Tue, 20 Feb 2007 15:25:04 GMT
Server Apache/2.0.54 (Fedora)