木子屋 Dnawo's BLOG

新云允许链接本站的域名设置失效分析

👤 dnawo 📅 2009-04-22 👁 5435 👍 0 💬 0 🔄 本站原创
在NewAsp CMS Version 4.0.0 SP1的后台常规设置中有一项允许链接本站的域名,通过设置可以允许其他站点链接使用本站的资源(外链):

图片

奇怪的是如上图示已经在XX站后台设置允许www.mzwu.com外链,但从mzwu上转到资源下载链接时还是跳转到了防盗链页面,允许链接本站的域名设置失效了!什么原因呢?搜索到新云防盗链相关代码:

Public Function CheckOutLinks()
	On Error Resume Next
	Dim server_v1,server_v2,i,Allowlists
	CheckOutLinks=False
	If Trim(MainSetting(49))="*" Then
		CheckOutLinks=True
		Exit Function
	End If
	server_v1 = LCase(Request.ServerVariables("HTTP_REFERER"))
	server_v2 = LCase(Request.ServerVariables("SERVER_NAME"))
	Allowlists = server_v2&","&MainSetting(49)
	Allowlists=Split(LCase(Allowlists),",")
	If Len(server_v1)>1 Then
		If InStr(9,server_v1,"/")>0 Then server_v1=Mid(server_v1,1,InStr(9,server_v1,"/"))
		For i=0 to Ubound(Allowlists)
			If InStr(server_v1,Allowlists(i))>0 And Len(Allowlists(i))>1 Then
				CheckOutLinks=True
				Exit For
			End If
		Next
	Else
		CheckOutLinks=False
	End If
End Function

代码没问题,难道Request.ServerVariables("HTTP_REFERER")接收有问题?在XX站上增加了一个页面专门获取HTTP_REFERER的值并显示,得到的是空值!最终发现是mzwu上使用Response.Redirect在服务器端跳转到资源地址下载,而使用Response.Redirect跳转Request.ServerVariables("HTTP_REFERER")获取不到值,目前没有解决方法😢

评论(0)

暂无评论。

计算题
评论需审核通过后显示
← 上一篇 VS2008对引发异常和再次引发捕获异常的建议 下一篇 → C#字符串数组所有项组成一个字符串的方法