method One: Simple, no parameters, only one virtual path
Copy Code code as follows:
For example: HTTP://127.0.0.1/SHIYAN.ASP?DFSDFSF=DSFSDFD&AA=DDDD
Get as: shiyan.asp
Copy Code code as follows:
<%
Dim Changdu,url,ends,wurl
Changdu=len (Request. ServerVariables ("URL"))
Url=instrrev (Request. ServerVariables ("URL"), "/"
Url=url+1
Ends=changdu+1-url
Wurl=mid (Request. ServerVariables ("URL"), Url,ends)
%>
method Two: Get the whole URL, get the parameter
Copy Code code as follows:
' Get the address of the current page
Function GetUrl ()
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") <> Then strtemp = strtemp & ":" & Request.ServerVariables ("SER Ver_port ")
strtemp = strtemp & Request.ServerVariables ("URL")
If Trim (request.querystring) <> "" Then strtemp = strtemp & "?" & Trim (Request.QueryString)
GETURL = strtemp
End Function
For example: HTTP://127.0.0.1/SHIYAN.ASP?DFSDFSF=DSFSDFD&AA=DDDD
Get as: http://127.0.0.1/shiyan.asp?dfsdfsf=dsfsdfd&aa=dddd
method Three: Get the virtual path, get the parameter
Copy code code as follows:
Private Function GetUrl ()
Dim Scriptaddress,m_itemurl,m_item
scriptaddress = CStr (Request.ServerVariables ("Script_name")) ' Get current address
M_itemurl = ""
If (Request.QueryString <> "") Then
scriptaddress = scriptaddress & "?"
For each m_item in Request.QueryString
If M_item = "Page_num" Then Exit for ' The function here is to filter out the parameters of this page of Page_num (this parameter is set by itself in the page_turn.asp, depending on the individual settings), otherwise each page will overlay this parameter, Although it does not affect the function, but it is not very good
If InStr (page,m_item) =0 Then
M_itemurl = M_itemurl & m_item & "=" & Server.URLEncode (Request.QueryString ("" &M_Item& ""))
Else
M_itemurl = M_itemurl & m_item & "=" & Server.URLEncode (Request.QueryString ("" &M_Item& ")) &" & "
End If
Next
Else
scriptaddress = scriptaddress & "?"
End If
GETURL = scriptaddress & M_itemurl
End Function
For example: HTTP://127.0.0.1/SHIYAN.ASP?DFSDFSF=DSFSDFD&AA=DDDD
Get as:/shiyan.asp?dfsdfsf=dsfsdfd&aa=dddd
method Four: Get only the parameter part string
Copy Code code as follows:
Function GetUrl ()
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") <> Then strtemp = strtemp & ":" & Request.ServerVariables ("SER Ver_port ")
strtemp = strtemp & Request.ServerVariables ("URL")
If Trim (request.querystring) <> "" Then strtemp = strtemp & "?" & Trim (Request.QueryString)
GETURL = strtemp
Geturl=mid (Geturl,instr (Geturl, "?") +1)
End Function
For example: HTTP://127.0.0.1/SHIYAN.ASP?DFSDFSF=DSFSDFD&AA=DDDD
Get as: dfsdfsf=dsfsdfd&aa=dddd