/// <summary>
/// 獲取網頁html源文件
/// </summary>
/// <param name="url">網頁地址</param>
/// <param name="encodingStr">網頁文件編碼字符串</param>
/// <returns>html源文件</returns>
#region GetPageSource
public static string GetPageSource(string url
{
HttpWebResponse res = null;
string strResult = "";
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest
//req
req
req
req
req
res = (HttpWebResponse)req
StreamReader reader = new StreamReader(res
strResult = reader
reader
}
catch
{
}
finally
{
if (res != null)
{
res
}
}
return strResult;
}
From:http://tw.wingwit.com/Article/program/net/201311/14461.html