您正在使用 IPV4 [54.152.77.92] 访问本站,您本次已经查看了 1 页
用户名: 密 码: 验证码:     用QQ登录本站
首页 软件 编程 笑话 知识 公告 台风 日历 计算器
[公益]保护绿色环境,构建和谐社会       悟空收录网      

【腾讯云】 爆款2核2G3M云服务器首年 61元,叠加红包再享折上折      
[公益] 地球是我家,绿化靠大家      
2024年 清明节 007
2024年 劳动节 034
2025年 元 旦 279
2025年 春 节 307
 
您现在的位置:首页 >> ASP/ASP.net >> 内容
本类新增
本类热门
asp获取当前完整路径(url)的函数代码
内容摘要: 函数1%functionGetUrl()onErrorResumeNextDimstrTempifLCase(request.ServerVariables('HTTPS'))='off'ThenstrTemp='http://'ElsestrTemp='https://'endifstrTemp=strTempRequest.ServerVariables......
函数1

<%

functionGetUrl()

onErrorResumeNext

DimstrTemp

ifLCase(request.ServerVariables("HTTPS"))="off"Then

strTemp="http://"

Else

strTemp="https://"

endif

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

ifRequest.ServerVariables("SERVER_PORT")<>80ThenstrTemp=strTemp&":"&Request.ServerVariables("SERVER_PORT")

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

iftrim(request.QueryString)<>""ThenstrTemp=strTemp&"?"&Trim(Request.QueryString)

GetUrl=strTemp

EndFunction

response.writeGetUrl()

%>

函数2

<!--获取当前页面路径-->

<%

dimstr,host,url,keyword,full

str="http://";

host=Request.ServerVariables("HTTP_HOST")

url=Request.ServerVariables("PATH_INFO")'或url

keyword=Request.ServerVariables("QUERY_STRING")

ifkeyword<>""then

full=str&host&url&"?"&keyword

else

full=str&host&url

endif

session("url")=full

%>

使用的话肯定选择第一个,支持https的判断。

如果是通过404页面除非,这个是获取不到的,需要结合js来实现

例如:

js页面

<script>

varpathname=window.location.pathname;

location.replace("/do.asp?p="+pathname);

</script>

将路径传参给do.asp进行处理

strpath=Request("p")

即可获取404之前的页面,然后进行执行操作即可,注意目录权限。也可以放到404中处罚iframe进行操作。

版权声明:本内容来源于互联网,如有侵犯您的版权,请联系站长,本站收到您的信息后将及时处理。
上一篇:将字符串里的关键词标记为红色

 

下一篇:取文件大小

发布日期:2022/3/2
手机扫二维码直达本页
发布时间:10:03:02
点  击:9
录  入:齐天大圣
相关文章
Baidu
YiJiaCMS 7.3.8 build231228(MSSQL) 闽ICP备05000814号-1
本空间由腾讯云(轻量应用服务器)提供,Cloudflare提供加速防护
运行时间载入中.....