asp网站通过限制请求防止被采集的函数
网络整理 - 09-06
今天在网上看到防采集代码,我把它放到这里与大家共享。此代码的缺点是:也防了蜘蛛。
<%
Dim AppealNum,AppealCount
AppealNum=10 '同一IP60秒内请求限制10次
AppealCount=Request.Cookies("AppealCount")
If AppealCount="" Then
response.Cookies("AppealCount")=1
AppealCount=1
response.cookies("AppealCount").expires=dateadd("s",60,now())
Else
response.Cookies("AppealCount")=AppealCount+1
response.cookies("AppealCount").expires=dateadd("s",60,now())
End If
if int(AppealCount)>int(AppealNum) then
response.write "歇一会儿吧!整天采集你烦不烦啊!"
response.end
End If
%>