using System.Net;
using System.IO;
private string GetPageCodes(string Url)
{
string strHtml = "";
WebRequest web = WebRequest.Create(Url);
//WebResponse hwr = web.GetResponse();
HttpWebResponse hwr = (HttpWebResponse)web.GetResponse();
//采用流读取,并确定编码方式
Stream s = hwr.GetResponseStream();
StreamReader objReader = new StreamReader(s, Encoding.Default);
string strLine = "";
while (strLine != null)
{
strLine = objReader.ReadLine();
if (strLine != null)
{
strHtml += strLine;
}
}
return strHtml;
}