欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

用asp.net實(shí)現(xiàn) 取頁面中的所有鏈接

 更新時(shí)間:2007年05月15日 00:00:00   作者:  
private void Page_Load(object sender, System.EventArgse) 
  { 
   //在此處放置用戶代碼以初始化頁面 

   string url =http://www.dbjr.com.cn; 
   System.Net.HttpWebRequesthttpReq; 
   System.Net.HttpWebResponsehttpRes; 
   System.UrihttpURL = new Uri(url); 
   httpReq =(System.Net.HttpWebRequest)System.Net.WebRequest.Create(httpURL); 
   httpReq.Method= "GET"; 
   httpRes= (System.Net.HttpWebResponse)httpReq.GetResponse(); 
   httpReq.KeepAlive= false; 
   System.IO.StreamReadersReader = newSystem.IO.StreamReader(httpRes.GetResponseStream(),System.Text.Encoding.GetEncoding("GB2312")); 
   stringres = sReader.ReadToEnd(); 
   //以下是利用正則表達(dá)式對(duì)獲取的文本流進(jìn)行過濾 
   stringstrRegex = @"<a.+?a>"; 
   System.Text.RegularExpressions.Regexr; 
   System.Text.RegularExpressions.MatchCollectionm; 
   r = newSystem.Text.RegularExpressions.Regex(strRegex,System.Text.RegularExpressions.RegexOptions.IgnoreCase); 
   m =r.Matches(res); 
   Response.Write("該頁共有"+m.Count + " 個(gè)超連接<br/>"); 
   for (inti = 0; i < m.Count; i++) 
   { 
    Response.Write(m[i].Value+ "<br/>"); 
   } 
  } 

相關(guān)文章

最新評(píng)論