บทความนี้ส่วนใหญ่แนะนำรหัสที่ใช้ ASP เพื่อห้ามแมงมุมเครื่องมือค้นหาจากการเข้าถึง
รหัสนี้สามารถควบคุมเครื่องมือค้นหาทั่วไปเพื่อไม่ให้เข้าถึงหน้า ASP และจำเป็นต้องรวมรหัสนี้ไว้ในแต่ละหน้า ASP
- -
- FunctionIsspider ()
- ตัวแทน Dimi Searray
- agent = agent: & lcase (request.serverVariables (http_user_agent)))
- Searray = Array (googlebot, baiduspider, sogouspider, yahoo, sosospider)
- ISSPIDER = FALSE
- fori = 0toubund (Searray)
- if (instr (agent, searray (i))> 0) thenissPider = true
- ต่อไป
- endfunction
- function fromse ()
- Dimurlrefer, Searay, i
- urlrefer = อ้างอิง: & lcase (request.serverVariables (http_referer)))
- fromse = false
- ifurlrefer = thingfromse = false
- Searray = Array (Google, Baidu, Sogou, Yahoo, Soso)
- fori = 0toubund (Searray)
- if (instr (urlrefer, searray (i))> 0) จากนั้น fromse = true
- ต่อไป
- endfunction
- ถ้า (isspider ()) แล้ว
- dimmyfso, fileurl, filecon, myfile
- fileUrl = server.mappath (images/bg01.gif)
- setMyFSO = server.createObject (scripting.filesystemobject)
- ifmyfso.fileexists (fileUrl) จากนั้น
- setMyFile = myfso.opentextfile (fileurl, 1)
- fileCon = myFile.Readall
- Response.write (FileCon)
- myfile.close
- setMyFile = ไม่มีอะไร
- setMyfso = ไม่มีอะไร
- Response.end
- endif
- endif
- ถ้า (Fromse ()) แล้ว
- Response.write (<br/>)
- Response.end
- อื่น
- endif
- -
ข้างต้นเป็นเนื้อหาทั้งหมดของบทความนี้ฉันหวังว่าคุณจะชอบ