asp.net(c#)捕捉搜索引擎蜘蛛和機器人
更新時間:2008年08月16日 13:37:25 作者:
結合這個你就可以寫一個蜘蛛訪問記錄了,如何判斷正常用戶或者蜘蛛?可以粗略的這樣來判斷:通過判斷用戶的訪問來源頁面
下面是訪問日志文件
2008-8-13 14:43:22
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
2008-8-13 14:43:27
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
2008-8-13 14:44:18
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
2008-8-13 14:44:26
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; QQDownload 1.7; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
2008-8-13 14:45:17
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
打開這個文件,這個文件用于記錄訪問搜索吧的正常訪客或者機器人蜘蛛,從中提取的蜘蛛有: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Gigabot/3.0 (http://www.gigablast.com/spider.html)
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.yodao.com/help/webmaster/spider/; )
Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)
msnbot/1.1 (+http://search.msn.com/msnbot.htm)
Baiduspider+(+http://www.baidu.com/search/spider.htm)
代碼也十分的簡單:
string agent = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];
if (agent == null)
{
Response.Write("Other");
}
else
{
Response.Write(agent);
}
你可以自己用這個代碼試下,發(fā)現(xiàn)會輸出類似: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler 4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
結合這個你就可以寫一個蜘蛛訪問記錄了,如何判斷正常用戶或者蜘蛛?可以粗略的這樣來判斷:通過判斷用戶的訪問來源頁面,比如從jb51.net/index.htm這個文件點進show.asp?id=11那么他的來源頁面我們知道就是jb51.net/index.htm,那么粗略判斷他就是正??蛻?。而蜘蛛的來源則不是,把這部分不是的記錄下來,再從中選擇??梢越Y合數(shù)據(jù)庫進行記錄。
2008-8-13 14:43:22
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
2008-8-13 14:43:27
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
2008-8-13 14:44:18
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
2008-8-13 14:44:26
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon; QQDownload 1.7; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
2008-8-13 14:45:17
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
打開這個文件,這個文件用于記錄訪問搜索吧的正常訪客或者機器人蜘蛛,從中提取的蜘蛛有: Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
Gigabot/3.0 (http://www.gigablast.com/spider.html)
Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)
Mozilla/5.0 (compatible; YodaoBot/1.0; http://www.yodao.com/help/webmaster/spider/; )
Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)
msnbot/1.1 (+http://search.msn.com/msnbot.htm)
Baiduspider+(+http://www.baidu.com/search/spider.htm)
代碼也十分的簡單:
復制代碼 代碼如下:
string agent = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];
if (agent == null)
{
Response.Write("Other");
}
else
{
Response.Write(agent);
}
你可以自己用這個代碼試下,發(fā)現(xiàn)會輸出類似: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler 4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
結合這個你就可以寫一個蜘蛛訪問記錄了,如何判斷正常用戶或者蜘蛛?可以粗略的這樣來判斷:通過判斷用戶的訪問來源頁面,比如從jb51.net/index.htm這個文件點進show.asp?id=11那么他的來源頁面我們知道就是jb51.net/index.htm,那么粗略判斷他就是正??蛻?。而蜘蛛的來源則不是,把這部分不是的記錄下來,再從中選擇??梢越Y合數(shù)據(jù)庫進行記錄。
相關文章
動態(tài)ItemTemplate的實現(xiàn)(譯) - item,template
動態(tài)ItemTemplate的實現(xiàn)(譯) - item,template...2007-02-02
asp.net計算一串數(shù)字中每個數(shù)字出現(xiàn)的次數(shù)
計算一串數(shù)字中每個數(shù)字出現(xiàn)的次數(shù),可以這樣子,先判斷輸入的字符串是不是數(shù)字組成,還是否包含有其它字符2012-05-05
詳解ASP.Net Core 中如何借助CSRedis實現(xiàn)一個安全高效的分布式鎖
這篇文章主要介紹了ASP.Net Core 中如何借助CSRedis實現(xiàn)一個安全高效的分布式鎖,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2019-04-04
asp.net動態(tài)產(chǎn)生checkbox(數(shù)據(jù)源為DB或內(nèi)存集合)
動態(tài)產(chǎn)生一組checkbox(數(shù)據(jù)源為DB或內(nèi)存集合)且post提交時后臺能及時獲取等等,打算使用repeater+input(checkbox)+input(hidden)來實現(xiàn)2013-10-10

