求救:页面提示缺少对象,附上源代码
本人想写一个页面,获取访问者的ip地址,然后判断其是否属于某网段,若不属于则转另外一个页面。
可是在获取ip地址的时候就遇到问题:提示缺少对象,郁闷!!请教各位大侠是什么原因?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "
<%@ LANGUAGE= "VBSCRIPT "%>
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd ">
<!-- saved from url=(0065)http://www.wenzhou.gov.cn/gb/wz/shouye/part/down-first/index.html -->
<HTML> <HEAD> <TITLE> zz </TITLE>
<META http-equiv=Content-Type content= "text/html; charset=gb2312 ">
<STYLE type=text/css> BODY {
MARGIN: 0px
}
.downtext {
COLOR: #ec2429; TEXT-DECORATION: none
}
.downtext:hover {
COLOR: #000000; TEXT-DECORATION: underline
}
</STYLE>
<META content= "MSHTML 6.00.2900.3086 " name=GENERATOR> </HEAD>
<%
Dim strIP
StrIP = resquest.ServerVariables( "REMOTE_ADDR ")
%>
<BODY>
<a href=http://192.200.144.200:1000/webquery/login/login.asp target=_blank> <img src= "/images/xt3.GIF " width= "167 " height= "31 " border= "0 "> </a>
</BODY> </HTML>
------解决方案--------------------request拼错了
------解决方案--------------------StrIP = resquest.ServerVariables( "REMOTE_ADDR ")
-----------------------------------------------
格式有些问题啊~~~~~~~~~
------解决方案--------------------Function GetIP() '获取IP地址
GetIP = Request.ServerVariables( "HTTP_X_FORWARDED_FOR ")
If GetIP = " " Then GetIP = Request.ServerVariables( "REMOTE_ADDR ")
End Function
------解决方案--------------------点图片後还是要递交会服务器端进行判断
aIP = split(strIP, ". ")
aAD = split( "172.16.112 ", .)
b = False;
For i = 0 To 2
If aIP[i] <> aAD[i] Then
b = False
Exit For
End If
Next
If b Then
response.redirect "ok.asp "
Else
response.redirect "error.asp "
End If
------解决方案--------------------学习一下
------解决方案--------------------ip 地址没有获取~
------解决方案--------------------IP网段应该有个数据库的吧.把你获取的IP在数据据库里查一下不就知道了啊.
再判断你获取的网段是不是符合你的要求.
IP=Request.ServerVariables( "HTTP_X_FORWARDED_FOR ")
网段名=conn.execute( "select 网段名 from 网段表 where ip= ' "&IP& " ' ")(0)
if 网段名=符合你的网段名 then
response.redirect "ok.asp "
else
response.redirect "error.asp "
end if