Asp:
Request.ServerVariables("HTTP_REFERER") 获取上一页URL
获取当前页地址:
代码
sub
procUpdateReportUrl(objConn)
Dim urlStr
if Request.ServerVariables( " SERVER_PORT " ) <> " 443 " then
urlStr = " http:// "
else
urlStr = " https:// "
end if
urlStr = urlStr & Request.ServerVariables( " SERVER_NAME " ) & Request.ServerVariables( " URL " )
if Request.ServerVariables( " QUERY_STRING " ) <> "" then
urlStr = urlStr & " ? " & Request.ServerVariables( " QUERY_STRING " )
end if
end sub
Dim urlStr
if Request.ServerVariables( " SERVER_PORT " ) <> " 443 " then
urlStr = " http:// "
else
urlStr = " https:// "
end if
urlStr = urlStr & Request.ServerVariables( " SERVER_NAME " ) & Request.ServerVariables( " URL " )
if Request.ServerVariables( " QUERY_STRING " ) <> "" then
urlStr = urlStr & " ? " & Request.ServerVariables( " QUERY_STRING " )
end if
end sub
asp.net:
Page.Request.UrlReferrer.ToString() 获取前一页URL
javascript:
document.referrer 获取上一页的URL
document.URL 获取当前页的URL(注:URL必须大写)