谁能解决得了这个???

时间:2021-12-05 18:33:54
我用了如下代码(是从某个地方抄来的):
Request.ServerVariables("HTTP_X_FORWARDED_FOR")来检查访问这事不是用了代理。可就是调不出来。
我在本地设了个服务器,在本地用了代理服务器测试的。可以得到 Request.ServerVariables("REMOTE_ADDR")得值,而判断的部分不行。指出来'没有用'的信息
Request.ServerVariables("HTTP_X_FORWARDED_FOR")是对的吗??

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
  response.write "<font color=#FF0000>您通过了代理服务器," & "真实的IP为" & 

Request.ServerVariables("HTTP_X_FORWARDED_FOR")
else
  response.write "您没有用代理 "
end if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body  >

<%=Request.ServerVariables("REMOTE_ADDR")%>
</body>
</html>

6 个解决方案

#1


??????????????????????????

#2


你的代码是复制的吧,使用这段代码试试
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
  response.write "<font color=#FF0000>您通过了代理服务器," & "真实的IP为" & 

Request.ServerVariables("HTTP_X_FORWARDED_FOR")
else
  response.write "您没有用代理 "
end if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body  >

<%=Request.ServerVariables("REMOTE_ADDR")%>
</body>
</html>

#3


更正:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
  response.write "<font color=#FF0000>您通过了代理服务器," & "真实的IP为" &_ 
Request.ServerVariables("HTTP_X_FORWARDED_FOR")
else
  response.write "您没有用代理 "
end if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body  >

<%=Request.ServerVariables("REMOTE_ADDR")%>
</body>
</html>

#4


帮我~~~~~~~~~~~~~~~~~~~~~``

#5


还是不行啊~~~
我的IP是202.4.143.136
http://202.4.143.136/ip1.asp

#6


http://202.4.143.136/ip1.asp

#1


??????????????????????????

#2


你的代码是复制的吧,使用这段代码试试
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
  response.write "<font color=#FF0000>您通过了代理服务器," & "真实的IP为" & 

Request.ServerVariables("HTTP_X_FORWARDED_FOR")
else
  response.write "您没有用代理 "
end if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body  >

<%=Request.ServerVariables("REMOTE_ADDR")%>
</body>
</html>

#3


更正:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% 
if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
  response.write "<font color=#FF0000>您通过了代理服务器," & "真实的IP为" &_ 
Request.ServerVariables("HTTP_X_FORWARDED_FOR")
else
  response.write "您没有用代理 "
end if
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body  >

<%=Request.ServerVariables("REMOTE_ADDR")%>
</body>
</html>

#4


帮我~~~~~~~~~~~~~~~~~~~~~``

#5


还是不行啊~~~
我的IP是202.4.143.136
http://202.4.143.136/ip1.asp

#6


http://202.4.143.136/ip1.asp