Request.ServerVariables

Request.ServerVariables("http_host")
获取域名,形如www.csdn.net
Request.ServerVariables("url")
获取相对域名的http地址,参数除外
Request.ServerVariables("QUERY_STRING")
获取 HTTP 请求中问号(?)后的信息,不包括“?”号。 
 
如:   
http://expert.csdn.net/Expert/topic/view.asp?id=123456   
那么,

Request.ServerVariables("http_host")得到
expert.csdn.net
Request.ServerVariables("url")得到
/Expert/topic/view.asp
Request.ServerVariables("QUERY_STRING")得到
id=123456

 

 

 

 

 

几个常用Request.ServerVariables的中文
本文件ip路径:<%="http://" & request.servervariables("server_name")& request.servervariables("script_name") %>
本机ip:<%=request.servervariables("remote_addr")%>
服务器名:<%=Request.ServerVariables("SERVER_NAME")%
服务器IP:<%=Request.ServerVariables("LOCAL_ADDR")%
服务器端口:<%=Request.ServerVariables("SERVER_PORT")%
服务器时间:<%=now%
IIS版本:<%=Request.ServerVariables("SERVER_SOFTWARE")%
脚本超时时间:<%=Server.ScriptTimeout%><
本文件路径:<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
服务器CPU数量:<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
服务器解译引擎:<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion&"."& ScriptEngineBuildVersion %>
服务器操作系统:<%=Request.ServerVariables("OS")%>
支持的文件类型:<%=Request.ServerVariables("HTTP_Accept")%>
访问的文件路径:<%=Request.ServerVariables("HTTP_url")%>
用户代理的信息:<%=Request.ServerVariables("HTTP_USER_AGENT")%>
获取url中的文件名和传过来的值:request.ServerVariables("script_name")+"?"+request.ServerVariableS("QUERY_STRING")
---------------------------------------------------------------------------
产生的如下:
本文件ip路径:http://localhost/ceshi.asp
本机ip:127.0.0.1
服务器名:localhost
服务器IP:127.0.0.1
服务器端口:8091
服务器时间:2005-7-27
IIS版本:Microsoft-IIS/5.0
脚本超时时间:90
本文件路径:E:/hospital/ceshi.asp
服务器CPU数量:2
服务器解译引擎:VBScript/5.6.7426
服务器操作系统: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, */*
访问的文件路径:/ceshi.asp
用户代理的信息:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Maxthon; COM+ 1.0.2204)
如若获得此文件的目录可以利用下面的函数
Public Function ServerPath
Dim Path
Path="http://" & Request.ServerVariables("server_name") & Request.ServerVariables("script_name")
Pos=InStrRev(Path,"/")
ServerPath=Left(Path,Pos)
End Function
%>
所在文件目录:<%=ServerPath%>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值