WebRequest访问aspx页面,然后获取Response流,得到的就是html
private void button1_Click(object sender, System.EventArgs e)
{
textBox1.Text=this.GetUrlValue("http://www.webjx.com");
}
//使用HttpWebRequest获得URL的返回值
public string GetUrlValue(string url)
{
System.Net.WebRequest HttpWebRequest=System.Net.WebRequest.Create(url);
System.Net.WebResponse HttpWebResponse =HttpWebRequest.GetResponse();
System.IO.StreamReader sr=new System.IO.StreamReader(HttpWebResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("GB2312"));
return sr.ReadToEnd();
}