网页信息抓取

 //创建http链接
            var request = (HttpWebRequest)WebRequest.Create("http://www.cnblogs.com/huangxincheng/archive/2012/03/14/2395279.html");

            request.Timeout = 1000 * 5;    //5s过期

            var response = (HttpWebResponse)request.GetResponse();

            Stream stream = response.GetResponseStream();

            StreamReader sr = new StreamReader(stream);

            string content = sr.ReadToEnd();
            Console.WriteLine(content);

posted on 2013-03-28 17:51  水行者  阅读(135)  评论(0编辑  收藏  举报

导航