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

首頁 > 編程 > ASP > 正文

asp實(shí)現(xiàn)禁止搜索引擎蜘蛛訪問的代碼

2024-05-04 11:10:00
字體:
供稿:網(wǎng)友

這篇文章主要介紹了asp實(shí)現(xiàn)禁止搜索引擎蜘蛛訪問的代碼,十分的簡單實(shí)用,有需要的小伙伴可以參考下。

這段代碼可以控制常用的搜索引擎無法訪問asp頁面,需要在每個(gè)asp頁面包含這段代碼。

 

 
  1. <% 
  2. function isspider() 
  3. dim i,agent,searray 
  4. agent="agent:"&LCase(request.servervariables("http_user_agent")) 
  5. searray=array("googlebot","baiduspider","sogouspider","yahoo","Sosospider"
  6. isspider= false 
  7. for i=0 to ubound(searray) 
  8. if (instr(agent,searray(i))>0) then isspider=true 
  9. next 
  10. end function 
  11.  
  12. function fromse() 
  13. dim urlrefer,searray,i 
  14. urlrefer="refer:"&LCase(request.ServerVariables("HTTP_REFERER")) 
  15. fromse= false 
  16. if urlrefer="" then fromse= false 
  17. searray=array("google","baidu","sogou","yahoo","soso"
  18. for i=0 to ubound(searray) 
  19. if (instr(urlrefer,searray(i))>0) then fromse=true 
  20. next 
  21. end function 
  22.  
  23. if(isspider()) then 
  24. dim myfso,fileurl,filecon,myfile 
  25. fileurl=Server.MapPath("images/bg01.gif"
  26. Set myfso=Server.CreateObject("Scripting.FileSystemObject"
  27. if myfso.FileExists(fileurl) then 
  28. Set myfile=myfso.OpenTextFile(fileurl, 1) 
  29. filecon=myfile.readAll 
  30. response.write(filecon) 
  31. myfile.Close 
  32. Set myfile=Nothing 
  33. Set myfso=Nothing 
  34. response.end 
  35. end if 
  36. end if  
  37. if (fromse()) then 
  38. response.write("<br/>"
  39. response.end 
  40. else 
  41. end if 
  42. %> 

以上所述就是本文的全部內(nèi)容了,希望大家能夠喜歡。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 东乌珠穆沁旗| 惠安县| 东宁县| 航空| 晋中市| 交城县| 丰台区| 涿鹿县| 凤阳县| 马关县| 桃园县| 汝南县| 迁西县| 荃湾区| 镇宁| 彰武县| 五寨县| 莫力| 敖汉旗| 沾化县| 宜都市| 三明市| 保定市| 都兰县| 全南县| 思茅市| 翼城县| 太仆寺旗| 东莞市| 酒泉市| 宁城县| 大兴区| 察隅县| 峨边| 达孜县| 湖口县| 日土县| 锡林浩特市| 芒康县| 南川市| 屏东市|