获取URL地址的方法

it2026-05-20  10

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

asp.net:

      HttpContext.Current.Request.Url.PathAndQuery 获取当前页URL

      Page.Request.UrlReferrer.ToString() 获取前一页URL

 

javascript:

document.referrer  获取上一页的URLdocument.URL      获取当前页的URL(注:URL必须大写) 

 

转载于:https://www.cnblogs.com/lfzwenzhu/archive/2010/02/22/1671297.html

相关资源:数据结构—成绩单生成器
最新回复(0)