asp判断页面来路是否为指定的域名,其他域名或者直接输入网址都将做跳转,代码如下:
<%
on error resume next
Dim strComeUrl,strHosturl,strHostname
strComeUrl=lcase(trim(request.ServerVariables("HTTP_REFERER")))
strHosturl=lcase(trim(request.servervariables("HTTP_HOST")))
strHosturl=split(strHosturl,".")
If ubound(strHosturl)=1 Then'1级
strHostname=strHosturl(0)&chr(46)&strHosturl(1)
ElseIf ubound(strHosturl)=2 Then '2级
strHostname=strHosturl(1)&chr(46)&strHosturl(2)
ElseIf ubound(strHosturl)=3 Then '3级
strHostname=strHosturl(1)&chr(46)&strHosturl(2)&chr(46)&strHosturl(3)
End If
If instr(strComeUrl,strHostname)<1 Then
response.redirect ("/")
response.End
End If
%>