Sometimes you need to get the URL, port, path file name, parameters, etc. Here I will share this function code with you. Friends who need it can refer to it.
Function 1
<%function GetUrl() on Error Resume Next Dim strTempif LCase(request.ServerVariables("HTTPS")) = "off" ThenstrTemp = "http://"ElsestrTemp = "https://" end if strTemp = strTemp & Request.ServerVariables("SERVER_NAME") if Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT") strTemp = strTemp & Request.ServerVariables("URL") if trim(request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString) GetUrl = strTempEnd Functionresponse.write GetUrl()%>Function 2
<!--Get the current page path--><%dim str,host,url,keyword,fullstr="http://";host = Request.ServerVariables("HTTP_HOST")url = Request.ServerVariables("PATH_INFO") 'or urlkeyword = Request.ServerVariables("QUERY_STRING")if keyword <> "" thenfull = str&host&url&"?"&keyworddelsefull = str&host&urlend ifsession("url")=full%>If you use it, you must choose the first one, which supports https judgment.
If it is through a 404 page, this cannot be obtained, and it needs to be implemented in combination with js
For example:
js page
<script>var pathname = window.location.pathname;location.replace("/do.asp?p="+pathname);</script>Pass the path parameter to do.asp for processing
strpath=Request("p")
You can get the page before 404, and then perform the operation, pay attention to directory permissions. You can also put it in 404 and punish the iframe for operation.