HTTP_REFERER的工作方式

下列情况是从浏览器的地址栏正常取得Request.ServerVariables("HTTP_REFERER")的:
1.直接用

 1<a href="">   
 22.用Submit或<input type="image"/>提交的表单(POST or GET)   
 33.使用Jscript提交的表单(POST or GET) 
 4
 5下面我们再看看Request.ServerVariables("HTTP_REFERER")不能正常取值的情况:   
 61.从收藏夹链接   
 72.单击'主页'或者自定义的地址   
 83.利用Jscript的location.href or location.replace()   
 94.在浏览器直接输入地址   
105.```
11Response.Redirect

6.``` Response.AddHeader

17.用XML加载地址 
2
3显然,Request.ServerVariables("HTTP_REFERER")在多数情况下是不能正常工作的,下面我们看一个例子:   
4ref.asp   

response.write "You came from: " &amp; request.servervariables("http_referer")

1
2ref.htm   

Response.AddHeader "Refresh", "10;URL=ref.asp"

 1
 2<meta content="10;URL=ref.asp" http-equiv="refresh"/>
 3<form action="ref.asp" method="GET" name="getform">
 4<input type="submit" value=" Go there (GET) &gt;&gt; "/>
 5<input style="cursor:hand" type="image"/>
 6</form><p>   
 7看看上面的代码会得到什么的结果.   
 8<form action="ref.asp" method="POST" name="postform">
 9<input type="submit" value=" Go there (POST) &gt;&gt; "/>
10<input style="cursor:hand" type="image"/>
11</form><p>
12<a href="ref.asp">直接链接<p>
13<a href="#" onclick='window.location.href="ref.asp";return false;'>javascript location</a>
14<a href="#" onclick='window.location.replace("ref.asp");return false;'>javascript replace</a>
15<a href="#" onclick="document.getform.submit();return false;">javascript GET</a>
16<a href="#" onclick="document.postform.submit();return false;">javascript POST </a></p></a></p></p></a>
Published At
Categories with Web编程
Tagged with
comments powered by Disqus