ASP如何取得当前页URL方法

来源:互联网 发布:107单片机http协议 编辑:程序博客网 时间:2024/05/18 07:32

'获取当前Url参数的函数A
 Private Function GetUrl()
  Dim ScriptAddress, M_ItemUrl, M_item
  ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) '取得当前地址
  M_ItemUrl = ""
  If (Request.QueryString <> "") Then
  ScriptAddress =  ScriptAddress & "?"
  For Each M_item In Request.QueryString
   If InStr(page,M_Item)=0 Then
    M_ItemUrl = M_ItemUrl & M_Item &"="& Server.URLEncode(Request.QueryString(""&M_Item&""))  & "&"
   End If
  Next
  end if
  GetUrl = ScriptAddress & M_ItemUrl
 End Function
'=============================


'获取当前页面URL的函数B

Function Cur_Url()    
  Domain_Name = LCase(Request.ServerVariables("Server_Name"))
  Page_Name = LCase(Request.ServerVariables("Script_Name"))
  Quary_Name = LCase(Request.ServerVariables("Quary_String"))
  If Quary_Name ="" Then
    Cur_Url = "http://"&Domain_Name&Page_Name
  Else
    Cur_Url = "http://"&Domain_Name&Page_Name&"?"&Quary_Name
  End If
End Function