Request.ServerVariables(”HTTP_REFERER”)防止下载盗链
2009-08-05 10:24
519 查看
Request.ServerVariables(”HTTP_REFERER”)的工作方式
下列情况是从浏览器的地址栏正常取得Request.ServerVariables(”HTTP_REFERER”)的:
1.直接用<a href>
2.用Submit或<input type=image>提交的表单(POST or GET)
3.使用Jscript提交的表单(POST or GET)
Request.ServerVariables(”HTTP_REFERER”)不能正常取值的情况:
1.从收藏夹链接
2.单击”主页”或者自定义的地址
3.利用Jscript的location.href or location.replace()
4.在浏览器直接输入地址
5.<%Response.Redirect%>
6.<%Response.AddHeader%>或<meta http-equiv=refresh>转向
7.用XML加载地址
显然,Request.ServerVariables(”HTTP_REFERER”)在多数情况下是不能正常工作的,正因为这个原因,在防止下载盗链时我们才能使Request.ServerVariables(”HTTP_REFERER”)。
如一例:
下载系统网址列表,就是访问你下载页面的域名或IP,比如你的下载页可以用多个网址来访问,可用逗号隔开。
下列情况是从浏览器的地址栏正常取得Request.ServerVariables(”HTTP_REFERER”)的:
1.直接用<a href>
2.用Submit或<input type=image>提交的表单(POST or GET)
3.使用Jscript提交的表单(POST or GET)
Request.ServerVariables(”HTTP_REFERER”)不能正常取值的情况:
1.从收藏夹链接
2.单击”主页”或者自定义的地址
3.利用Jscript的location.href or location.replace()
4.在浏览器直接输入地址
5.<%Response.Redirect%>
6.<%Response.AddHeader%>或<meta http-equiv=refresh>转向
7.用XML加载地址
显然,Request.ServerVariables(”HTTP_REFERER”)在多数情况下是不能正常工作的,正因为这个原因,在防止下载盗链时我们才能使Request.ServerVariables(”HTTP_REFERER”)。
如一例:
以下是代码片段: ‘下载系统网址列表,不要带上http:// domain=”2ky.cn,61.156.14.223″ splDomain=split(domain,”,”) strReferer=Request.ServerVariables(”HTTP_REFERER”) for iii = 0 to ubound(splDomain) if instr(strReferer,trim(splDomain(iii)))>0 then isHttp=True next if isnull(strReferer) or isHttp=false then Response.Write “下载链接来自非法盗链,<a href=”http://www.2ky.cn/“>请进入共享世纪页面后再进行下载。</a>” CloseDatabase response.end end if |
相关文章推荐
- Request.ServerVariables(”HTTP_REFERER”)防止下载盗链
- Request.ServerVariables["HTTP_REFERER"]
- Request.ServerVariables(HTTP_REFERER) 适用和不适用的情况
- ASP 使用 Request.ServerVariables(HTTP_REFERER) 方法获取请求页面地址的注意事项
- Request.ServerVariables(HTTP_REFERER)&数据提交时注意的问题
- Request.ServerVariables(HTTP_REFERER) 获取方式注意
- :Request.ServerVariables("HTTP_REFERER")的工作方式
- Request.ServerVariables(HTTP_REFERER)
- Request.ServerVariables("HTTP_REFERER")的工作方式
- Request.ServerVariables("HTTP_REFERER")的工作方式
- 关于Request.ServerVariables("HTTP_REFERER")
- HTTP_REFERER是什么 与 Request.ServerVariables("HTTP_REFERER")的用法(防外连接)
- 关于 Request.ServerVariables("HTTP_REFERER") 运行时会出错的原因
- Request.ServerVariables(HTTP_REFERER)
- 程序中无法获得Request.ServerVariables("HTTP_REFERER")的值,寻求解决方法~~~~
- Request.ServerVariables("HTTP_REFERER")不能使用
- PHP 防止盗链$_SERVER["HTTP_REFERER"]的用法举例
- ASP解决 request.ServerVariables("HTTP_REFERER") 乱码
- Request.ServerVariables("HTTP_USER_AGENT")
- HttpContext.Current.Request.ServerVariables.AllKeys