您的位置:首页 > 其它

实现根据教育网IP/公网IP进行不同服务器转向(学习)

2009-06-04 11:37 423 查看
场景:提高公网、教育网用户个自的访问速度,公网用户使用公网服务器、教育网用户使用教育网服务器。
解决办法(从来没整个asp,花了2个小时查资料,整出这么一东西):

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body>
<% = Request.ServerVariables("REMOTE_ADDR") %>
<% ip = Request.ServerVariables("REMOTE_ADDR")

set conn=Server.createobject("ADODB.CONNECTION") '创建连接对象
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "C:\Inetpub\wwwroot\EduIP.mdb"

set rs=Server.CreateObject("ADODB.recordset")
sql = "select ipaddress from tbi_eduip where ipaddress like'"+ip+"%'"
rs.Open sql,conn,1,1

if (rs.RecordCount >0) then
response.Redirect("http://www.google.cn/")
else
response.Redirect("http://www.baidu.com/")
end if

conn.Close
%>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐