永发信息网

编程方面的一个小问题

答案:1  悬赏:20  手机版
解决时间 2021-05-10 18:55

有如下代码我想把它用c#来读取,有什么好的办法可以让他把所有内容全部读取出来吗?而且我只需要显示代码中的ID.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<title>ICDS - </title>
<link href="./../../css/fonts.css" rel="stylesheet" type="text/css">
<link href="./../../css/styles.css" rel="stylesheet" type="text/css">
<link href="./../../css/themes.css" rel="stylesheet" type="text/css">
<link href="./../../css/layout.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="20" topmargin="12"><script language="javascript">
function goto( page )
{
if ( page ) document.form1.pg.value = page;
document.form1.submit();
}
</script>
<div align="center"><form name="form1" method="post" action="CafesMutilServer.php?&sort=DESC&by=">

<table width="100%" border="1" cellpadding="0" cellspacing="0" class="data" >
<tr>
<td width="10%" class="menuHeader" nowrap><a href="?&sort=DESC&by=&sort=ASC">ID</a>&nbsp;<img src="../../images/s_DESC.png" border="0" width="11" height="9" title="递减" id="soimg1" /></td>
<td width="70%" class="menuHeader" nowrap><a href="?&sort=DESC&by=&sort=ASC&by=1">编号</a></td>
<td width="20%" class="menuHeader"><a href="?&sort=DESC&by=&sort=ASC&by=2">服务器数目</a></td>
</tr>
<tr>
<td><small>52102</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=52102">dsa.2</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>49402</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=49402">fde.4</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>39223</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=39223">ad.0003</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>30601</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=30601">ngd.0009</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>29761</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=29761">jkfjdsklda.00008</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>29561</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=29561">hgfd.0019</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>29281</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=29281">xiaozhao.0001</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>24302</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=24302">tianyuan</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>22421</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=22421">shishang</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>14783</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=14783">taiyangshan</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>14063</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=14063">3d-7-dfengshou-sanhe</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>14033</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=14033">3d-9-huozhi</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>13951</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=13951">3d-3-huijia</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>13884</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=13884">3d-2-boran</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>13840</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=13840">3d-5-xinxing</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>13298</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=13298">3d-5-deg-shenyangbozhonglong</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td><small>13006</small></td>
<td nowrap><small><a href="../cafe_detail.php?id=13006">wctq7-qidian.0012.0045</a></small></td>
<td><small>2</small></td>
</tr>
<tr>
<td valign="bottom" colspan="2">&nbsp;<a href="#" onClick="goto( 1 );" class="mainmenu">首页</a>&nbsp&nbsp<a href="#" onClick="goto( 1 );" class="mainmenu">上一页</a>&nbsp&nbsp<a href="#" onClick="goto( 3 );" class="mainmenu">下一页</a>&nbsp&nbsp<a href="#" onClick="goto( 7 );" class="mainmenu">末页</a>&nbsp&nbsp跳至第&nbsp<input name="pg" value=2 type="text" size=5 />&nbsp页&nbsp<input name="go" type="button" value="GO" OnClick="goto();" />&nbsp;&nbsp;(2 / 7)&nbsp;</td>
<td align="center">&nbsp;共计:103<input name="tot_records" type="hidden" value="103"></td>
</tr>
</table></form>
</div>
</body></html>

谢谢各位了。。。。。

最佳答案

没明白你是什么意思,你是说这些代码在网上,想通过域名用asp.net程序读出来是吗?


这个很简单,我给你段代码吧。



string Url = http://www.it300.net/index.asp; //要获得代码的页面地址
WebClient c = new WebClient();
byte[] b = c.DownloadData(Url);
string strOrgHTML = System.Text.Encoding.Default.GetString(b);
this.TextBox1.Text = strOrgHTML;


string pattern = @"<title>(?<name>[\s\S]*)(?=</title>)";
System.Text.RegularExpressions.MatchCollection results = Regex.Matches(strOrgHTML, pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
foreach (Match result in results)
{
Response.Write(result.Groups["name"].Value);//输出
}


你也可以把数据存成文本文件。

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
关于苏有朋的具体情况谁知道
难道我要继续沉默?
哈利波特的女朋友是叫金妮吗?是哪部开始交往
采出来的金石有人收吗?
湛江有什么好玩的呀
急!广州的朋友帮帮忙
什么工作,工资有1800元,
我怎样快速减肥!
问问中,如果没有满意答案而关闭,会不会减少
阿胶块受潮了怎么办?
鼻子上挂着秤砣歇后语,牛逼挂秤砣?歇后语
谁能帮我介绍一款2500-3500的商务笔记本电脑
绵阳到底风景好不好?
急寻2009 《马兰花》?
求两个符号打法
推荐资讯
求一首 有高字 和璇字的诗
仙途去哪里合成武器
足球实用过人动作
精武堂奶牛是什么
騰讯中奖咨询热线是什么
如何锻炼肺活量!!!!
7月8日周末这么多人同时进我的空间?
上周快乐大本营上有一女嘉宾独唱的一首歌?
这样的人让我痛恨句子,我真心没想到她是一个
福建一区,谁有诺斯玛尔:戾龙重甲护腿。
电磁炉主传感器
英雄岛 剑圣+龙战 给个 意见
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?