この記事では、ASPが検索エンジンのクモがアクセスすることを禁止するコードを紹介します。
このコードは、一般的な検索エンジンを制御してASPページにアクセスできないため、各ASPページにこのコードを含める必要があります。
- <%
- functionspider()
- ディミエージェントサレイ
- エージェント=エージェント:&lcase(request.servervariables(http_user_agent)))
- searray = array(GoogleBot、Baiduspider、Sogouspider、Yahoo、Sosospider)
- ISSPider = false
- fori = 0toubund(searray)
- if(strust(agent、searray(i))> 0)tenispider = true
- 次
- エンド機能
- functionfromse()
- Dimurlrefer、Searay、i
- urlRefer =参照:&lcase(request.servervariables(http_referer))
- fromse = false
- ifurlrefer = thenfromse = false
- Searray = Array(Google、Baidu、Sogou、Yahoo、Soso)
- fori = 0toubund(searray)
- if(urlrefer、searray(i))> 0)thenfromse = true
- 次
- エンド機能
- if(isspider())then
- dimmyfso、fileurl、filecon、myfile
- fileurl = server.mappath(images/bg01.gif)
- setmyfso = server.createObject(scripting.filesystemObject)
- ifmyfso.fileexists(fileurl)then
- setmyfile = myfso.opentextfile(fileurl、1)
- filecon = myfile.readall
- Response.write(filecon)
- myfile.close
- setMyFile =何もない
- setmyfso =何もない
- Response.End
- endif
- endif
- if(fromse())then
- Response.Write(<br/>)
- Response.End
- それ以外
- endif
- %>
上記はこの記事の全体的な内容です。あなたがそれを気に入っていただければ幸いです。