微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

asp中获取当前页面的地址与参数的函数

<%Function getcurrenturl() 

On Error Resume Next 

Dim strTemp 

If LCase(Request.ServerVariables("HTTPS")) = "off" Then 

strTemp = "http://" 

Else 

strTemp = "https://" 

End If 

strTemp = strTemp & Request.ServerVariables("SERVER_NAME") 

If Request.ServerVariables("SERVER_PORT") <> 80 Then 

strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT") 

end if 

strTemp = strTemp & Request.ServerVariables("URL") 

getcurrenturl = strTemp 

End Function

Response.Write getcurrenturl()

Response.Write("<BR><BR>")

Function getUrlWithParams() 

Dim ScriptAddress,Servername,qs 

ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME")) 

Servername = CStr(Request.ServerVariables("Server_Name")) 

qs=Request.QueryString 

If Request.ServerVariables("SERVER_PORT") <> 80 Then 

Servername = Servername & ":" & Request.ServerVariables("SERVER_PORT") 

end if 

if qs<>"" then 

getUrlWithParams ="http://"& Servername & ScriptAddress &"?"&qs 

else 

getUrlWithParams ="http://"& Servername & ScriptAddress 

end if 

End Function

Response.Write getUrlWithParams()%>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐