预览模式: 普通 | 列表

asp获得完整来源网址

Function GetUrl()
   Dim ScriptAddress, M_ItemUrl, M_item,urlid,urlid2
   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
   If right(M_ItemUrl,1) = "&" Then M_ItemUrl = Left(M_ItemUrl,Len(M_ItemUrl)-1)
   end if
   GetUrl ="http://"&Request.ServerVariables("Server_Name")&ScriptAddress & M_ItemUrl
  urlid =InStr(GetUrl,"&page")
  urlid2 =InStr(GetUrl,"?page")
'----------去除当前页的page参数--------
if urlid<>0 then
 GetUrl=left(GetUrl,urlid-1)&"&"
end if
if urlid2<>0 then
GetUrl=left(GetUrl,urlid2-1)&"?"
end if
'----------去除当前页的page参数--------  
End Function

Tags: asp

分类:技术文章 | 固定链接 | 评论: 0 | 引用: 0 | 查看次数: 3776

 广告位

↑返回顶部↑