日期:2014-05-17 浏览次数:20467 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.Collections;
using System.Text.RegularExpressions;
using System.Threading;
namespace TacCs2013.Caiji
{
public partial class Caiji : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void btnOK_Click(object sender, EventArgs e)
{
// 取得输入的URL地址
string PageUrl = txtUrl.Text;
WebClient wc = new WebClient();
//把已登录的用户或正被模拟的用户的用户凭据赋给用于对向Internet资源的请求进行身份验证的网络凭据
wc.Credentials = CredentialCache.DefaultCredentials;
///从指定的URI下载数据
Byte[] pageData = wc.DownloadData(PageUrl);
//把下载到的字符型数组数据转换成字符串类型
// lblc.Text = Encoding.UTF8.GetString(pageData);
string sHTML = Encoding.UTF8.GetString(pageData);
//取得网站路径
ArrayList alURL = GetHyperLinks(sHTML);//取得所有网站链接
string sUrl = "";//网站链接路径