This code can control the common search engine cannot access the ASP page, need to include this code in each ASP page.
<% function Isspider () Dim I,agent,searray agent= "Agent:" &lcase (Request.ServerVariables ("Http_user_agent")) Searray=array ("Googlebot", "Baiduspider", "Sogouspider", "Yahoo", "Sosospider") isspider= false for i=0 to UBound (
Searray) if (InStr (Agent,searray (i)) >0) then isspider=true Next End Function Function Fromse () Dim urlrefer,searray,i Urlrefer= "refer:" &lcase (Request). ServerVariables ("Http_referer")) fromse= False if Urlrefer= "" then fromse= false Searray=array ("Google", "Baidu", "Sogou "," Yahoo "," Soso ") for I=0 to UBound (Searray) if (InStr (Urlrefer,searray (i)) >0) then Fromse=true next End Function if ( 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 If
if (Fromse ()) Then Response.Write ("<br/>") Response.End else End If%>
The above is the entire contents of this article, I hope you can enjoy.