ASP编程:怎么得到当前网页所在文件夹的HTTP地址

来源:百度知道 编辑:UC知道 时间:2024/05/31 20:51:03
如,1.asp的地址是"http://www.XXX.com/filename/1.asp"
我要怎么得到这1.asp所在的网址"http://www.XXX.com/filename/"
里的所有网页转到(或打开{防frameset衔接})1.asp这个文件时能正常显示网页,其它地方来的都只显示"请从本站正门走!"

'str1为代码所在文件的url目录
str1="http://"&Request.ServerVariables("SERVER_Name")& left(Request.ServerVariables("URL"),InstrRev(Request.ServerVariables("URL"),"/"))
'str2为跳转之前的文件所在的url目录
str2=left(Request.ServerVariables("Http_Referer"),InstrRev(Request.ServerVariables("Http_Referer"),"/"))

if not str1=str2 then
response.write("请从本站正门走!")
response.end
end if