首页后端开发ASP.NETasp实现禁止搜索引擎蜘蛛访问的代码

asp实现禁止搜索引擎蜘蛛访问的代码

时间2024-02-07 17:16:03发布访客分类ASP.NET浏览579
导读:收集整理的这篇文章主要介绍了asp实现禁止搜索引擎蜘蛛访问的代码,觉得挺不错的,现在分享给大家,也给大家做个参考。 这段代码可以控制常用的搜索引擎无法访问asp页面,需要在每个asp页面...
收集整理的这篇文章主要介绍了asp实现禁止搜索引擎蜘蛛访问的代码,觉得挺不错的,现在分享给大家,也给大家做个参考。

这段代码可以控制常用的搜索引擎无法访问asp页面,需要在每个asp页面包含这段代码。

%function isspider()dim i,agent,searrayagent="agent:"&
    LCase(request.serverVARiables("http_user_agent"))searray=array("GOOGLEbot","BaiduSpider","sogouspider","yahoo","Sosospider")isspider= falsefor i=0 to ubound(searray) if (instr(agent,searray(i))>
    0) then isspider=truenextend functionfunction Fromse()dim urlrefer,searray,iurlrefer="refer:"&
    LCase(request.ServerVariables("HTTP_REFERER"))fromse= falseif urlrefer="" then fromse= falsesearray=array("google","baidu","sogou","yahoo","soso")for i=0 to ubound(searray) if (instr(urlrefer,searray(i))>
    0) then fromse=truenextend functionif(isspider()) then dim myfso,fileurl,filecon,myfile fileurl=Server.MapPath("images/bg01.gif") Set myfso=Server.CreateObject("Scripting.FileSystemObject") if myfso.FileExists(fileurl) then  Set myfile=myfso.OPEnTextFile(fileurl, 1)  filecon=myfile.readAll  response.wrITe(filecon)  myfile.Close  Set myfile=Nothing  Set myfso=Nothing  response.end end ifend if                if (fromse()) then response.write("br/>
    ") response.endelseend if%>
    

以上所述就是本文的全部内容了,希望大家能够喜欢。

您可能感兴趣的文章:
  • asp.net(c#)捕捉搜索引擎蜘蛛和机器人
  • asp 判断是否为搜索引擎蜘蛛的代码
  • php 判断访客是否为搜索引擎蜘蛛的函数代码
  • PHP判断搜索引擎蜘蛛并自动记忆到文件的代码
  • PHP屏蔽蜘蛛访问代码及常用搜索引擎的HTTP_USER_AGENT
  • PHP记录搜索引擎蜘蛛访问网站足迹的方法
  • php/asp/asp.net中判断百度移动和PC蜘蛛的实现代码
  • 根据user-agent判断蜘蛛代码黑帽跳转代码(js版与php版本)

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: asp实现禁止搜索引擎蜘蛛访问的代码
本文地址: https://pptw.com/jishu/604328.html
ASP实现强制图片下载函数 asp、html、js 禁止缓存的代码

游客 回复需填写必要信息