Request.ServerVariables的所有值

来源:互联网 发布:cygwin运行linux软件 编辑:程序博客网 时间:2024/04/29 17:30
 

web开发中如何获取诸如:NT Account,访问者IP地址等信息,Request.ServerVariable数组为我们提供了方法。

在asp和asp.net(c#)中对于Request.ServerVariables数组中的取值方式有所不同,以获取NT Account为例:

asp:Request.ServerVariables("LOGON_USER")

asp.net(c#):Request.ServerVariables("LOGON_USER")

Request.ServerVariables的所有值:

ALL_HTTP=HTTP_ACCEPT:image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* HTTP_ACCEPT_LANGUAGE:zh-cn HTTP_CONNECTION:Keep-Alive HTTP_HOST:localhost:88 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) HTTP_COOKIE:ASPSESSIONIDSQBTBADS=HDDLKAKAAJDKPHHBNBBAACLH HTTP_ACCEPT_ENCODING:gzip, deflate
ALL_RAW=Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Language: zh-cn Connection: Keep-Alive Host: localhost:88 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322) Cookie: ASPSESSIONIDSQBTBADS=HDDLKAKAAJDKPHHBNBBAACLH Accept-Encoding: gzip, deflate
APPL_MD_PATH=/LM/W3SVC/1/Root/xml
APPL_PHYSICAL_PATH=C:/Documents and Settings/khaspc/桌面/olcr_1/1/
AUTH_PASSWORD=
AUTH_TYPE=
AUTH_USER=
CERT_COOKIE=
CERT_FLAGS=
CERT_ISSUER=
CERT_KEYSIZE=
CERT_SECRETKEYSIZE=
CERT_SERIALNUMBER=
CERT_SERVER_ISSUER=
CERT_SERVER_SUBJECT=
CERT_SUBJECT=
CONTENT_LENGTH=0
CONTENT_TYPE=
GATEWAY_INTERFACE=CGI/1.1
HTTPS=off
HTTPS_KEYSIZE=
HTTPS_SECRETKEYSIZE=
HTTPS_SERVER_ISSUER=
HTTPS_SERVER_SUBJECT=
INSTANCE_ID=1
INSTANCE_META_PATH=/LM/W3SVC/1
LOCAL_ADDR=127.0.0.1
LOGON_USER=
PATH_INFO=/xml/request.s.asp
PATH_TRANSLATED=C:/Documents and Settings/khaspc/桌面/olcr_1/1/request.s.asp
QUERY_STRING=
REMOTE_ADDR=127.0.0.1
REMOTE_HOST=127.0.0.1
REMOTE_USER=
REQUEST_METHOD=GET
SCRIPT_NAME=/xml/request.s.asp
SERVER_NAME=localhost
SERVER_PORT=88
SERVER_PORT_SECURE=0
SERVER_PROTOCOL=HTTP/1.1
SERVER_SOFTWARE=Microsoft-IIS/5.1
URL=/xml/request.s.asp
HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP_ACCEPT_LANGUAGE=zh-cn
HTTP_CONNECTION=Keep-Alive
HTTP_HOST=localhost:88
HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
HTTP_COOKIE=ASPSESSIONIDSQBTBADS=HDDLKAKAAJDKPHHBNBBAACLH
HTTP_ACCEPT_ENCODING=gzip, deflate

本文件ip路径:<%="http://"&request.servervariables("server_name" ... bles("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")

 

相关文章:

http://dev.csdn.net/article/63/63508.shtm

http://mysheji.com/blog/article.asp?id=407