有时,您可能希望获得当前页面的网址是在浏览器窗口中显示网址。例如,如果您想让您的访客提交博客张贴到Digg您需要得到同样的确切网址。有很多其他原因也很多。这里就是你如何能够做到这一点。
下面的代码添加到页面:
<%
function curPageURL()
dim s, protocol, port
if Request.ServerVariables("HTTPS") = "on" then
s = "s"
else
s = ""
end if
protocol = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & s
if Request.ServerVariables("SERVER_PORT") = "80" then
port = ""
else
port = ":" & Request.ServerVariables("SERVER_PORT")
end if
curPageURL = protocol & "://" & Request.ServerVariables("SERVER_NAME") &_
port & Request.ServerVariables("SCRIPT_NAME")
end function
function strLeft(str1,str2)
strLeft = Left(str1,InStr(str1,str2)-1)
end function
%>
现在,您可以得到当前页面的URL使用行
<%
response.write(curPageURL())
%>
如果您的网页有你想要查询字符串信息以及您可以尝试这样的代码:
<%
response.write(curPageURL() & "?" & Request.ServerVariables("QUERY_STRING"))
%>
下面的示例演示如何做到这一点:
<%
function curPageName()
dim pagename
pagename = Request.ServerVariables("SCRIPT_NAME")
if inStr(pagename, "/") > 0 then
pagename = Right(pagename, Len(pagename) - instrRev(pagename, "/"))
end if
curPageName = pagename
end function
response.write("The current page name is " & curPageName())
%>
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级