All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
设置GridView的选中行效果代码_[Asp.Net教程]
网页的新颖效果 斜着滚动的marquee_[Html教程]
ASP.NET状态管理,APPlication,Session,Cookie和ViewStat用法_[Asp.Net教程]
千万级数据分页之二---一个简单的自定义分页控件_[Asp.Net教程]
当ASP.NET撞上JSF之校验输入方式的差异_[Asp.Net教程]
ASP.NET移动开发之SelectionList控件_.net资料_编程技术
页面根据不同Url显示不同Title以及不同的Mete_[Asp.Net教程]
SEO该如何进行图片优化?_百度优化_seo学堂
Javscript实现表单复选框的全选功能_JavaScript技术_编程技术
春节大盘点:.NET技术的回顾与展望_.net资料_编程技术
Reading number is top 10 pictures
Terrorist smile the largest human history an explosion2
Take you to walk into the most true north Korea rural4
2012 national geographic daily picture1
The little woman's bright wire1
美洲杯宝贝的雨中风情2
Startling Russian girl blind date scene3
西游日记3
The little woman's bright wire2
Absolutely shocked. National geographic 50 animal photographys8
A man's favorite things15
Download software ranking
Tram sex maniac 2 (H) rar bag6
jBuilder2006
网页特效实例大全
linux初级教程
ASP.NET.2.0.XML.高级编程(第3版)
WebService在.NET中的实战应用教学视频 → 第4集
Boxer vs Yellow5
美女写真1
dreamweaver8中文版
Boxer's Top ten classic battle7
delv published in(发表于) 2014/1/24 9:02:09 Edit(编辑)
.NET2.0抓取网页全部链接_[Asp.Net教程]

.NET2.0抓取网页全部链接_[Asp.Net教程]

.NET2.0抓取网页全部链接_[Asp.Net教程]

该方法经过对各大门户网站测试结果是抓取率100%!


效果图


后台代码:


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;
using System.Net;
using System.IO;
using System.Collections;


public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

}

}



protected void Button1_Click(object sender, EventArgs e)
{
TextBox2.Text = "";
string web_url = this.TextBox1.Text;//"http://blog.csdn.net/21aspnet/"
string all_code = "";
HttpWebRequest all_codeRequest = (HttpWebRequest)WebRequest.Create(web_url);
WebResponse all_codeResponse = all_codeRequest.GetResponse();
StreamReader the_Reader = new StreamReader(all_codeResponse.GetResponseStream());
all_code = the_Reader.ReadToEnd();
the_Reader.Close();
ArrayList my_list = new ArrayList();
string p = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
Regex re = new Regex(p, RegexOptions.IgnoreCase);
MatchCollection mc = re.Matches(all_code);


for (int i = 0; i <= mc.Count - 1; i++)
{
bool _foo = false;
string name = mc[i].ToString();
foreach (string list in my_list)
{
if (name == list)
{
_foo = true;
break;
}
}//过滤


if (!_foo)
{
TextBox2.Text += name + "\n";
}
}
}
}


前台
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>





抓取网页所有链接







onClick="Button1_Click" Text="提取" />








来源:http://blog.csdn.net/21aspnet/






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.