当前位置: 首页 > 图文教程 > 脚本技术 > DOS/BAT > 用asp.net实现 取页面中的所有链接

DOS/BAT
一个“灵异”批处理引发的思考加补充说明
批处理提取不同行上的内容的代码
windows 复制隐藏帐号完全批处理
使用regini.exe修改注册表命令
将bat文件注册为windows系统服务的方法
恶意软件\垃圾流氓通用反删除批处理文件
G8.3做的GHO G8.3不识别的问题的完美解决方案!
MD和RD命令的使用方法
DOS的启动过程详解分析
Msd、Undelete命令的使用方法
win32下的命令行集合
制作bat批处理和任意QQ号聊天!
用批处理实现将文件以数字重命名的代码
批处理之家发现的用批处理实现的系统类应用代码
纯脚本备份_还原驱动增强版附相关sleep.exe
批处理删除使用所有Windows Update功能的访问[图文+bat]
批处理 数码雨代码解释
按扩展名分类的批处理
批处理 网络配置信息查看器
获取文件更新列表 批处理

DOS/BAT 中的 用asp.net实现 取页面中的所有链接


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-11   浏览: 68 ::
收藏到网摘: n/a

private void Page_Load(object sender, System.EventArgse)
{
//在此处放置用户代码以初始化页面
string url =http://www.ruanchen.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/>");
}
}