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(); }