using System; using System.IO; using System.Net; public class TryWebRequest { public static void Main(String [] args) { WebRequest request = WebRequest.Create("http://www.navioo.com"); WebResponse response = request.GetResponse(); Console.WriteLine("Content length: {0}", response.ContentLength); Console.WriteLine("Content type: {0}\n", response.ContentType); Console.WriteLine("Request header count: {0}", request.Headers.Count); WebHeaderCollection header = request.Headers; for (int i = 0; i < header.Count; i++) Console.WriteLine("{0} : {1}", header.GetKey(i), header[i]); Console.WriteLine(); StreamReader input = new StreamReader(response.GetResponseStream()); Console.WriteLine(input.ReadToEnd()); input.Close(); } }