ASP取得当前页面地址的方法

ASP中如何取得当前网页的地址???

发布者:IT人在线 | 发表时间:2018/12/1 23:43:32

取得当前页面地址  Request.ServerVariables("URL")

取得当前页面域名 Request.ServerVariables("Server_Name")

取得当前页面地址中的?后的值request.ServerVariables("QUERY_STRING")

 

比如,当前正在浏览的地址是:
http://www.baidu.com/cp.asp?a=1

如何在这个cp.asp里面加个语句使其页面中显示出来这个地址
不是只显示http://www.baidu.com/cp.asp
最重要的还要显示出来后面的“?a=1”(也就是要显示出来整个“http://www.baidu.com/cp.asp?a=1

<%
html="http://"
html=html&Request.ServerVariables("Server_Name")
html=html&Request.ServerVariables("URL")

if request.ServerVariables("QUERY_STRING")<>"" then
html = html &"?"& Request.ServerVariables("QUERY_STRING")
end if
response.write html

%>