文章标签 ‘ServerVariables’

ServerVariables

ServerVariables 集合检索预定的环境变量。

语法
Request.ServerVariables (server environment variable)

阅读全文...

2009年12月3日22:07 | 评论关闭
分类: 程序代码

asp判断页面来路是否为指定的域名,其他域名或者直接输入网址都将做跳转,代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<%
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
%>

2009年12月3日21:44 | 评论关闭
分类: 程序代码