Categories


Tags


抢先式多线程网络蜘蛛

  抢先式多线程网络蜘蛛

整理自网络ChatGPT产生之内容,文本内容不具备参考意义,程序内容及代码片段有且仅有借鉴意义。

  框架
//      Copyright(C) 2017 铭飞科技
//
#region 版权信息
/*
 * 此文件自 Copyright(C) 2008 - 2017 铭飞科技 Classification:无 开源网站:http://www.http://www. coding
 */
#endregion


using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;


namespace Web.Templates.UI
{
    /// 
    /// 标签树控件
    /// 
    public class Tree : System.Web.UI.WebControls.TreeView
    {
        private string _styleName = "";

        /// 
        /// 样式
        /// 
        /// The name of the style.
        public string StyleName
        {
            get { return _styleName; }
            set { _styleName = value; }
        }

        private string _checkedValue = "";

        /// 
        /// 默认选中当前值
        /// 
        /// The checked value.
        public string CheckedValue
        {
            get { return _checkedValue; }
            set { _checkedValue = value; }
        }

        private string _checkBoxName = "";

        /// 
        /// 复选框名称
        /// 
        /// The check box name.
        public string CheckBoxName
        {
            get { return _checkBoxName; }
            set { _checkBoxName = value; }
        }

        private int _checkParentType = -1;

        /// 
        /// 
        /// 
        /// The type of the check parent.
        public int CheckParentType
        {
            get { return _checkParentType; }
            set { _checkParentType = value; }
        }

        private int _checkChildType = -1;

        /// 
        /// 
        /// 
        /// The type of the check child.
        public int CheckChildType
        {
            get { return _checkChildType; }
            set { _checkChildType = value; }
        }

        private string _showLevel = "999";

        /// 
        /// 显示层级
        /// 
        /// The show level.
        public string ShowLevel
        {
            get { return _showLevel; }
            set { _showLevel = value; }
        }

        private string _valueField = "id";

        /// 
        /// 编号字段名
        /// 
        /// The value field.
        public string ValueField
        {
            get { return _valueField; }
            set { _valueField = value; }
        }

        private string _textField = "title";

        /// 
        /// 显示字段名
        /// 
        /// The text field.
        public string TextField
        {
            get { return _textField; }
            set { _textField = value; }
        }

        private string _fatherField = "parentid";

        /// 
        /// 父编号字段名
        /// 
        /// The father field.
        public string FatherField
        {
            get { return _fatherField; }
            set { _fatherField = value; }
        }

        private TreeNodeBindEventHandler _onBind;

        /// 
        /// 构建事件
        /// 
        /// The on bind event.
        public event TreeNodeBindEventHandler OnBind
        {
            add { _onBind += value; }
            remove { _onBind -= value; }
        }

        private DataTable _dataSource;

        /// 
        /// 数据源
        /// 
        /// The data source.
        public DataTable DataSource
        {
            get { return _dataSource; }
            set { _dataSource = value; }
        }

        /// 
        /// 绑定数据
        /// 
        public override void DataBind()
        {
            this.Nodes.Clear();
            this.ShowCheckBox = this.CheckBoxName != "" && this.CheckBoxName != null;

            if (_dataSource != null)
            {
                TreeNode root_node = new TreeNode();
                root_node.Value = "-1";
                root_node.Text = "根目录";
                Nodes.Add(root_node);

                List root_list = new List();
                for (int i = 0; i < _dataSource.Rows.Count; i++)
                {
                    TreeNode node = new TreeNode();
                    DataRow dr = _dataSource.Rows[i];

                    node.Value = dr[_valueField].ToString();
                    node.Text = dr[_textField].ToString();
                    node.SelectAction = TreeNodeSelectAction.None;
                    //node.Depth =int.Parse(_showLevel);
                    if (_onBind != null)
                    {
                        _onBind(node);
                    }

                    if (dr[_fatherField].ToString() == "-1" || dr[_fatherField].ToString() == "0")
                    {
                        Nodes.Add(node);
                        if (node.Value == _checkedValue)
                        {
                            node.Checked = true;
                        }

                        int has = 0;
                        for (int j = 0; j < root_list.Count; j++)
                        {
                            if (root_list[j] == int.Parse(node.Value))
                            {
                                has = 1;
                            }
                        }
                        if (has == 0)
                        {
                            root_list.Add(int.Parse(node.Value));
                        }
                    }
                    else
                    {
                        TreeNode father_node = GetNode(root_node, dr[_fatherField].ToString());
                        if (father_node != null)
                        {
                            father_node.ChildNodes.Add(node);
                            if (node.Value == _checkedValue)
                            {
                                node.Checked = true;
                            }
                        }
                    }
                }
                //绑定事件,自动勾选父级节点
                if (this.CheckParentType == 0 || this.CheckChildType == 0)
                {
                    string enterjvice = "";
                    if (this.CheckParentType == 0)
                    {
                        enterjvice += "FatherChecked";
                    }
                    if (this.CheckChildType == 0)
                    {
                        enterjvice += "ChildChecked";
                    }
                    if (enterjvice != "" && this.Nodes.Count > 0)
                    {
                        this.Attributes.Add("onclick", "JscAutoCheckedNode(this,'" + enterjvice + "');");
                    }
                }
            }
            base.DataBind();
        }

        /// 
        /// 构建HTML
        /// 
        /// The  object that receives the server control content.
        protected override void Render(HtmlTextWriter writer)
        {
            string[] style_list = new string[] { "admin_tree", "data_tree", "input_tree", "menu_tree", "popmenu_tree" };
            switch (_styleName)
            {
                case "menu_tree":
                    this.ShowCheckBox = false;
                    this.CssClass += " menu";
                    break;
                case "popmenu_tree":
                    this.

Public @ 2023-02-24 22:24:01 整理自网络ChatGPT产生之内容,文本内容不具备参考意义,程序内容有且仅有借鉴意义。

BaiDuSpider百度蜘蛛占用流量,robots.txt设置

在网站根目录下的 robots.txt 文件可以用来告诉搜索引擎蜘蛛(包括百度蜘蛛)哪些页面可以访问,哪些页面不可访问。通过设置 robots.txt 文件,可以控制蜘蛛的爬取范围,减少不必要的流量消耗。 以下是一个提供给百度蜘蛛的 robots.txt 示例: ``` User-agent: Baiduspider Disallow: /path/to/disallowed/page.htm

Public @ 2023-07-28 12:00:44

如何判断是否冒充Baiduspider的抓取?

建议您使用DNS反查方式来确定抓取来源的ip是否属于百度,根据平台不同验证方法不同,如linux/windows/os三种平台下的验证方法分别如下:5.1 在linux平台下,您可以使用host ip命令反解ip来判断是否来自Baiduspider的抓取。Baiduspider的hostname以 *.baidu.com 或 *.baidu.jp 的格式命名,非 *.baidu.com 或 *.b

Public @ 2022-04-26 15:38:41

Google爬行缓存代理(crawl caching proxy)

前两天人们注意到Google Adsense蜘蛛所抓取的网页会出现在搜索结果中。Matt Cutts在他的博客里迅速的做出了回应,对这种现象做了进一步解释。简单来说,Google在完成大爸爸数据中心升级后,各种蜘蛛抓取网页的机制产生了变化。不是各个蜘蛛直接抓取网页,而是由一个爬行缓存代理crawl caching proxy抓取网页,然后不同的蜘蛛从这个缓存中获取内容,从而节省了带宽。Matt C

Public @ 2019-08-28 16:22:27

网站抓取了一些不存在的目录跟页面?

网站抓取了一些不存在的目录跟页面,本站倒是一个都不抓取是怎么回事?微信 悬赏网站抓取了一些不存在的目录跟页面,本站倒是一个都不抓取是怎么回事?要如何做才能让百度来抓取本站页面,一个多页了啥都没抓取,谜一样。。。以下抓取页面都不存在,另外网站例如新闻页面生成的文章在根目录是没有的,应该是动态的,这是否导致都不抓取了呢?回答:你确定蜘蛛是真的百度蜘蛛吗?99.99%的概率是假蜘蛛,不是真的!来源:A5

Public @ 2010-05-17 16:05:02

更多您感兴趣的搜索

0.467102s