Categories


Tags


抢先式多线程网络蜘蛛

框架 // 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:25:29

我不想我的网站被Baiduspider访问,我该怎么做?

Baiduspider遵守互联网robots协议。您可以利用robots.txt文件完全禁止Baiduspider访问您的网站,或者禁止 Baiduspider访问您网站上的部分文件。 注意:禁止Baiduspider访问您的网站,将使您的网站上的网页,在百度搜索引擎以及所有百度提供搜索引擎服务的搜索引擎中无法被搜索到。关于 robots.txt的写作方法,请参看我们的介绍:robots.txt写

Public @ 2017-02-03 15:38:41

【官方说法】只需两步,正确识别百度蜘蛛(User-Agent)

1. 查看User-Agent字段:当访问网站时,每个请求都会包含一个User-Agent字段,其中包含了请求的来源和类型等信息。如果该字段中包含了“Baiduspider”或“Baidu”等关键词,则说明该请求来自百度蜘蛛。 2. 检查IP地址:百度蜘蛛的IP地址通常为百度公司的IP地址,用于爬取和收集网站内容。如果该请求的IP地址为百度的IP地址,则说明该请求来自百度蜘蛛。 注意:需要注意

Public @ 2023-06-16 06:00:26

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

可能是因为网站存在未处理的URL链接或者被其他网站或者搜索引擎误解导致的,也有可能是恶意的爬虫在尝试攻击网站。为了解决这个问题,可以通过以下方式进行: 1. 对于不存在的页面,应该返回404错误页面或者301重定向到一个已有的页面; 2. 建立一个robots.txt文件来限制搜索引擎或者爬虫的访问; 3. 定期检查日志文件来发现存在攻击性的IP地址或者爬虫; 4. 部署防火墙、权限管理和加密措

Public @ 2023-05-30 19:00:18

如何和搜索引擎爬虫对话

作为AI语言模型,我无法实际与搜索引擎爬虫对话,但我可以提供以下有关如何处理爬虫的指导: 1. 确保您的网站结构和内容易于爬行。将所有页面都链接在一起,并为每个页面添加描述性的标题和标记。 2. 在网站中使用robots.txt文件来指定搜索引擎爬虫的访问权限。 3. 将所有内容放在HTML中,而不是JavaScript或Flash中,因为搜索引擎爬虫无法识别JavaScript和Flash内容

Public @ 2023-05-27 13:50:15

更多您感兴趣的搜索

0.574623s