日期:2011-07-01  浏览次数:20386 次

  public string GetWeb(string website)
  {
   try
   {
    string strHtmlContent="";
    string SourceUrl=website;
    System.Net.HttpWebRequest myrequest=(System.Net.HttpWebRequest)System.Net.WebRequest.Create(SourceUrl);
    myrequest.Timeout=5000;
    myrequest.Headers.Set("Pragma", "no-cache");
    System.Net.HttpWebResponse myresponse=(System.Net.HttpWebResponse)myrequest.GetResponse();
    System.IO.Stream mystream=myresponse.GetResponseStream();
    System.Text.Encoding myencoding=System.Text.Encoding.GetEncoding("Gb2312");
    System.IO.StreamReader mystreamreader=new System.IO.StreamReader(mystream,myencoding);
    strHtmlContent=mystreamreader.ReadToEnd();
    return strHtmlContent;   
   }
   catch
   {
    return "读取错误";
   }
  }