根据Url得到html代码
string rl;
WebRequest myReq=WebRequest.Create("http://www.126.com");
WebResponse myRes=myReq.GetResponse();
Stream resStream=myRes.GetResponseStream();
StreamReader sr=new StreamReader(resStream,Encoding.Default);
StringBuilder sb=new StringBuilder();
while((rl=sr.ReadLine())!=null)
{
sb.Append(rl);
}
this.TextBox1.Text=sb.ToString();
myRes.Close();
WebRequest myReq=WebRequest.Create("http://www.126.com");
WebResponse myRes=myReq.GetResponse();
Stream resStream=myRes.GetResponseStream();
StreamReader sr=new StreamReader(resStream,Encoding.Default);
StringBuilder sb=new StringBuilder();
while((rl=sr.ReadLine())!=null)
{
sb.Append(rl);
}
this.TextBox1.Text=sb.ToString();
myRes.Close();
本文使用Blog_Backup未注册版本导出,请到soft.pt42.com注册。