using System.Net; using System; using System.IO; public class WebPagesApp { [STAThread] public static void Main(string[] args) { string s = "http://www.microsoft.com"; Uri uri = new Uri(s); WebRequest req = WebRequest.Create(uri); WebResponse resp = req.GetResponse(); Stream str = resp.GetResponseStream(); StreamReader sr = new StreamReader(str); string t = sr.ReadToEnd(); int i = t.IndexOf("<HEAD>"); int j = t.IndexOf("</HEAD>"); string u = t.Substring(i, j); Console.WriteLine("{0}", u); } }