国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > BAT > 正文

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

2020-07-26 20:33:31
字體:
供稿:網(wǎng)友
private void Page_Load(object sender, System.EventArgse) 
  { 
   //在此處放置用戶代碼以初始化頁面 

   string url =http://www.survivalescaperooms.com; 
   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(); 
   //以下是利用正則表達式對獲取的文本流進行過濾 
   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 + " 個超連接<br/>"); 
   for (inti = 0; i < m.Count; i++) 
   { 
    Response.Write(m[i].Value+ "<br/>"); 
   } 
  } 
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 繁昌县| 清丰县| 昌宁县| 东兰县| 闽清县| 朝阳市| 孟州市| 原阳县| 浪卡子县| 青浦区| 育儿| 邻水| 晋城| 郓城县| 五峰| 房产| 鹰潭市| 大邑县| 上栗县| 穆棱市| 银川市| 柳河县| 西昌市| 青川县| 宜兰市| 金山区| 苏尼特左旗| 郯城县| 武强县| 勃利县| 扎兰屯市| 钟山县| 武义县| 浮梁县| 镇江市| 新营市| 石河子市| 郸城县| 浪卡子县| 当雄县| 富平县|