///<summary>
///get web page HTML source file
///</summary>
///<param name= "url" > Web address </ Param>
///<param name= "encodingstr" > Web page File encoding string </param>
///<returns>html source file </ Returns>
#region Getpagesource
public static string Getpagesource (string url, string encodingstr)
{
Ht Tpwebresponse res = null;
String strresult = "";
Try
{
HttpWebRequest req = (HttpWebRequest) webrequest.create (URL);
//req. method = "POST";
Req. KeepAlive = true;
Req. ContentType = "application/x-www-form-urlencoded";
Req. Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
Req. useragent = "mozilla/5.0" (Windows; U Windows NT 5.2; ZH-CN; rv:1.9.2.8) gecko/20100722 firefox/3.6.8 ";
Res = (HttpWebResponse) req. GetResponse ();
StreamReader reader = new StreamReader (res. GetResponseStream (), encoding.getencoding (ENCODINGSTR));
Strresult = reader. ReadToEnd ();
Reader. Close ();
}
Catch
{
}
Finally
{
if (res!= null)
{
Res. Close ();
}
}
return strresult
}