In ASP development, you often need to use the path of the current page, which is relative, absolute, with parameters and without parameters. Here we will sort it out, I personally feel that ASP is very full about getting the page path statement, for example: request. servervariables script_name server_software File IP Path: <% = "http: //" & request. servervariables ("SERVER_NAME") & request. servervariables ("script_name") %> <br/>
Local IP address: <% = request. servervariables ("remote_addr") %> <br/>
Server Name: <% = request. servervariables ("SERVER_NAME") %> <br/>
Server IP address: <% = request. servervariables ("local_addr") %> <br/>
Server port: <% = request. servervariables ("server_port") %> <br/>
Server time: <% = now %> <br/>
IIS Version: <% = request. servervariables ("server_software") %> <br/>
Script Timeout: <% = server. scripttimeout %> <br/>
Path of this file: <% = server. mappath (request. servervariables ("script_name") %> <br/>
Server CPU usage: <% = request. servervariables ("number_of_processors") %> <br/>
Server interpretation engine: <% = scriptengine & "/" & scriptenginemajorversion & "." & scriptengineminorversion & "." & scriptenginebuildversion %> <br/>
Server Operating System: <% = request. servervariables ("OS") %> <br/>
Supported file types: <% = request. servervariables ("http_accept") %> <br/>
Path of the accessed file: <% = request. servervariables ("http_url") %> <br/>
User Agent Information: <% = request. servervariables ("http_user_agent") %> <br/>
get the file name in the URL and the passed value: request. servervariables ("script_name") + "? "+ Request. servervariables ("QUERY_STRING")
events
are generated as follows:
ip address path of this file: http: // localhost/Ceshi. ASP
local IP Address: 127.0.0.1
server name: localhost
Server IP Address: 127.0.0.1
server port: 8091
server time: 14:28:04
IIS Version: Microsoft-IIS/5.0
script Timeout: 90
path of this file: e: \ hospital \ Ceshi. ASP
server CPU quantity: 2
server interpretation engine: VBScript/5.6.7426
server operating system: windows_nt
supported file types: image/GIF, image/X-xbitmap, image/JPEG, image/pjpeg, application/vnd. MS-PowerPoint, application/vnd. MS-Excel, application/MSWord, application/X-Shockwave-flash, */*
file path:/Ceshi. ASP
User Agent Information: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; COM + 1.0.2204)
If you get the directory of this file, you can use the following functions:
<%
Public Function serverpath
Dim path
Dim POS
Path = "http: //" & request. servervariables ("SERVER_NAME") & request. servervariables ("script_name ")
Pos = Limit Rev (path ,"/")
Serverpath = left (path, POS)
End Function
%>
====================================< Br>
File directory: <% = serverpath %>
====================================< Br>
The running result is:
File directory: http: // localhost/=========================