欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-05-03 12:47:38
复制代码 代码如下:function getcurrenturl() on error resume next dim strtemp if lcase(request.s...
复制代码 代码如下:

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

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