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

首頁 > 編程 > .NET > 正文

.NET2.0抓取網(wǎng)頁全部鏈接_.Net教程

2024-07-10 12:50:04
字體:
供稿:網(wǎng)友

推薦:asp.net初學者:petshop4.0設(shè)計說明
petshop4.0設(shè)計說明 一、項目名稱及描述:(實現(xiàn)步驟為:4-3-6-5-2-1)1、WEB=表示層2、BLL=業(yè)務(wù)邏輯層3、IDAL=數(shù)據(jù)訪問層接口定義4、Model=業(yè)務(wù)實體5、DALFactory=數(shù)據(jù)層

效果圖

后臺代碼

以下為引用的內(nèi)容:
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";
}
}
}
}

前臺

以下為引用的內(nèi)容:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>抓取網(wǎng)頁所有鏈接</title>

</head>
<body >
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Width="481px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="提取" />
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="304px" TextMode="MultiLine" Width="524px"></asp:TextBox></div>
</form>
</body>
</html>

分享:三層架構(gòu)各層間的訪問過程
1、傳入值,將值進行類型轉(zhuǎn)換(為整型)。2、創(chuàng)建bll層的對象,通過對象訪問bll層的方法調(diào)用bll層。3、bll層方法中取得數(shù)據(jù)訪問層的實例,實例化idal層的接口對象,這個對象是由工廠層創(chuàng)建的

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 繁峙县| 若尔盖县| 天气| 扎囊县| 中阳县| 开远市| 永春县| 大新县| 英超| 光泽县| 鹤壁市| 钟山县| 揭东县| 封丘县| 怀来县| 八宿县| 松溪县| 越西县| 山东省| 时尚| 边坝县| 侯马市| 灌南县| 保亭| 清流县| 盱眙县| 兴城市| 江永县| 武夷山市| 台湾省| 志丹县| 阿拉善盟| 建平县| 蕉岭县| 安阳市| 宣威市| 大厂| 南和县| 文山县| 台北县| 米泉市|