通过点击查看“html源码”按钮就弹出一个对话框显示博客园首页的html源码        private string GetCnBlogs()
        {
            string html = String.Empty;            
            HttpWebRequest cnbogs = (HttpWebRequest)System.Net.WebRequest.Create(txtURL.Text.ToString());
            cnbogs.Accept = "image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/QVOD, application/QVOD, */*";
            cnbogs.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MALN; CIBA; InfoPath.2; .NET4.0C; .NET4.0E; Media Center PC 6.0; Tablet PC 2.0; AskTB5.6)";
            cnbogs.Method = "GET";

            HttpWebResponse cnblogsRespone = (HttpWebResponse)cnbogs.GetResponse();
            if (cnblogsRespone != null&&cnblogsRespone.StatusCode==HttpStatusCode.OK)
            {
                using(StreamReader sr = new StreamReader(cnblogsRespone.GetResponseStream()))  
                {
                    html = sr.ReadToEnd();
                }
            }
            return html;
        }

        private void btnGetHtml_Click(object sender, EventArgs e)
        {
            MessageBox.Show(GetCnBlogs());            
        }