简单抓取页面

示例代码:
        Uri uri = new Uri("http://www.wrox.com/");
        if (uri.Scheme == Uri.UriSchemeHttp)
        {
            HttpWebRequest request =(HttpWebRequest) HttpWebRequest.Create(uri);
            request.Method = WebRequestMethods.Http.Get;
            HttpWebResponse response =(HttpWebResponse)request.GetResponse();
            StreamReader read = new StreamReader(response.GetResponseStream());
            string tmp = read.ReadToEnd();
            response.Close();
            Panel1.GroupingText = tmp;
        }

posted @ 2011-02-11 10:40  IT苦行僧  阅读(164)  评论(0编辑  收藏  举报