采集网页代码
string weatherhtml = string.Empty;
HttpWebRequest webrt = (HttpWebRequest)WebRequest.Create("http://www.fjqx.gov.cn");
HttpWebResponse webrs = (HttpWebResponse)webrt.GetResponse();
//读取数据
Stream stream = webrs.GetResponseStream();
StreamReader srm = new StreamReader(stream, System.Text.Encoding.Default);
weatherhtml = srm.ReadToEnd();
//关闭打开的资源
srm.Close();
stream.Close();
webrs.Close();