用一个自定义函数来获取完整的URL地址,包括全部的参数字符串,自定义函数为GetUrl(),无需参数,用时候直接调用函数就可返回URL。
函数是基于ServerVariables("Script_Name")来编写的,函数返回完整的带参数的URL字符串。
Public Function GetUrl() Dim strTemp strTemp=Request.ServerVariables("Script_Name") If Trim(Request.QueryString)<> "" Then strTemp=strTemp&"?" For Each M_item In Request.QueryString strTemp=strTemp&M_item&"="&Server.UrlEncode(Trim(Request.QueryString(""&M_item&""))) next end if GetUrl=strTemp'函数返回的结果 End Function