deliberate lies - interactive DHTML

deliberate lies

Defiant, stony, deliberate, their lies will not get in my way.

c# 怎样通过一个Url 获取该Url 的页面html

 private void button1_Click(object sender, EventArgs e)
        {
                WebRequest request = WebRequest.Create(textBox1.Text);//实例化WebRequest对象
                WebResponse response = request.GetResponse();//创建WebResponse对象
                Stream datastream = response.GetResponseStream();//创建流对象

                Encoding ec = Encoding.UTF8;
                Encoding EC = Encoding.Default;

                StreamReader reader = new StreamReader(datastream, EC);
                string responseFromServer = reader.ReadToEnd();//读取数据
                richTextBox1.AppendText(responseFromServer);//添加到RichTextBox控件中
                reader.Close();
                datastream.Close();
                response.Close();
            
        }

 

posted on 2017-05-04 09:21  悲淚滿衣襟  阅读(2474)  评论(0编辑  收藏  举报

导航