標(biāo)簽: itasp | 分類: 開(kāi)發(fā)—VB-ASP |
一、將以下代碼放在一個(gè)asp頁(yè)面里,保存后在IE里查看運(yùn)行結(jié)果:
---------------------------------------------------------------------------------------------
本文件ip路徑:<%="http://" &request.servervariables("server_name")&request.servervariables("script_name")%>
本機(jī)ip:<%=request.servervariables("remote_addr")%>
服務(wù)器名:<%=Request.ServerVariables("SERVER_NAME")%><br/>
服務(wù)器IP:<%=Request.ServerVariables("LOCAL_ADDR")%><br/>
服務(wù)器端口:<%=Request.ServerVariables("SERVER_PORT")%><br/>
服務(wù)器時(shí)間:<%=now%><br/>
IIS版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%><br/>
腳本超時(shí)時(shí)間:<%=Server.ScriptTimeout%><br/>
本文件路徑:<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%><br/>
服務(wù)器CPU數(shù)量:<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%><br/>
服務(wù)器解譯引擎:<%=ScriptEngine & "/"&ScriptEngineMajorVersion
服務(wù)器操作系統(tǒng):<%=Request.ServerVariables("OS")%>
支持的文件類型:<%=Request.ServerVariables("HTTP_Accept")%>
訪問(wèn)的文件路徑:<%=Request.ServerVariables("HTTP_url")%>
用戶代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%>
獲取url中的文件名和傳過(guò)來(lái)的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING")<br/>
---------------------------------------------------------------------------------------------
運(yùn)行結(jié)果為:
本文件ip路徑:http://localhost/ceshi.asp
本機(jī)ip:127.0.0.1
服務(wù)器名:localhost
服務(wù)器IP:127.0.0.1
服務(wù)器端口:8091
服務(wù)器時(shí)間:2005-7-27 14:28:04
IIS版本:Microsoft-IIS/5.0
腳本超時(shí)時(shí)間:90
本文件路徑:E:\hospital\ceshi.asp
服務(wù)器CPU數(shù)量:2
服務(wù)器解譯引擎:VBScript/5.6.7426
服務(wù)器操作系統(tǒng):Windows_NT
支持的文件類型:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,application/vnd.ms-powerpoint, application/vnd.ms-excel,application/msword, application/x-shockwave-flash,*/*
訪問(wèn)的文件路徑:/ceshi.asp
用戶代理的信息:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon;COM+ 1.0.2204)
---------------------------------------------------------------------------------------------
二、如若獲得此文件的目錄可以利用下面的函數(shù):
<%
Public Function ServerPath
Dim Path
Dim Pos
Path="http://" & Request.ServerVariables("server_name") &Request.ServerVariables("script_name")
Pos=InStrRev(Path,"/")
ServerPath=Left(Path,Pos)
End Function
%>
=====================<br>
所在文件目錄:<%=ServerPath%><br>
=====================<br>
運(yùn)行結(jié)果為:
=====================
所在文件目錄:http://localhost/
=====================
-----------------------------------------------------
聯(lián)系客服