国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 咸丰县| 禄劝| 许昌市| 长岭县| 南充市| 盈江县| 和平区| 绥德县| 临安市| 贞丰县| 保亭| 东阿县| 上林县| 福安市| 台南市| 河北省| 进贤县| 来凤县| 河北区| 城口县| 静安区| 丹江口市| 西丰县| 砀山县| 池州市| 台东市| 贵德县| 平顶山市| 柯坪县| 内黄县| 静乐县| 雷山县| 印江| 胶州市| 刚察县| 吴江市| 兴国县| 彰武县| 景宁| 南丹县| 彝良县|