代码
/// <summary>
/// 获取页面源代码
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string GetPageResouceCode(string url)
{
    
try
    {
        WebRequest wrt 
= WebRequest.Create(url);
        WebResponse wrse 
= wrt.GetResponse();
        Stream strM 
= wrse.GetResponseStream();
        StreamReader SR 
= new StreamReader(strM, Encoding.UTF8);
        
string strallstrm = SR.ReadToEnd();
        
return strallstrm;
    }
    
catch {
        
return "";
    }
}

 

 posted on 2010-05-31 11:27  ︷起↘嚸.  阅读(200)  评论(0编辑  收藏  举报