ASP中,根据不同的客户端IP,自动变换显示的链接

来源:百度知道 编辑:UC知道 时间:2024/06/29 01:42:45
公司分内网和外网2个IP段,我的想法是

当125.*.*.*访问网站的的时候,显示 <a harf="www.baidu.com">百度</a>
当192.*.*.*访问网站的的时候,显示 <a harf="192.168.0.1/baidu.asp?true">百度</a>

请问asp中如何写?

<%function GetIp()
dim yyrealip,yyproxy
yyrealip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
yyproxy = Request.ServerVariables("REMOTE_ADDR")
if yyrealip = "" then
GetIp = yyproxy
else
GetIp = yyrealip
end if
end function
getiparry=split(GetIp,".")
if getiparry(0)="125" then
response.write "<a harf='www.baidu.com'>百度</a>"
end if
if getiparry(0)="192" then
response.write "<a harf='192.168.0.1/baidu.asp?true'>百度</a>"
end if

%>

if request.ServerVariables("REMOTE_ADDR")="192.********" then

<a harf="www.baidu.com">百度</a>

end if