日期:2014-05-17  浏览次数:21070 次

求ASP判断IP段后进行页面跳转代码
如果访问者的IP是在68.59.232.0-68.59.236.164这个范围内,页面就跳转到2.asp

------解决方案--------------------
<%
Dim userip,checkstr
userip = Request.ServerVariables( "HTTP_X_FORWARDED_FOR ")
If userip = " " Then
userip = Request.ServerVariables( "REMOTE_ADDR ")
End If
If Left(userip,8)= "68.59.23 " Then
checkstr=CDbl(Mid(userip,9,5))
if checkstr> =2.0 and checkstr <=6.164 then
response.redirect( "2.asp ")
end if
else
response.redirect( "1.asp ")
end if
%>