函数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进行操作。
|