非常教程

ASP参考手册

ASP ServerVariables 集合

ASP ServerVariables 集合

ASP ServerVariables 集合


ASP ServerVariables 集合

完整的 Request 对象参考手册

ServerVariables 集合用于取回服务器变量的值。

语法

Request.ServerVariables (server_variable)

参数 描述
server_variable 必需。要取回的 服务器变量 的名称。

服务器变量

Variable 描述
ALL_HTTP Returns all HTTP headers sent by the client. Always prefixed with HTTP_ and capitalized
ALL_RAW Returns all headers in raw form
APPL_MD_PATH Returns the meta base path for the application for the ISAPI DLL
APPL_PHYSICAL_PATH Returns the physical path corresponding to the meta base path
AUTH_PASSWORD Returns the value entered in the client's authentication dialog
AUTH_TYPE The authentication method that the server uses to validate users
AUTH_USER Returns the raw authenticated user name
CERT_COOKIE Returns the unique ID for client certificate as a string
CERT_FLAGS bit0 is set to 1 if the client certificate is present and bit1 is set to 1 if the cCertification authority of the client certificate is not valid
CERT_ISSUER Returns the issuer field of the client certificate
CERT_KEYSIZE Returns the number of bits in Secure Sockets Layer connection key size
CERT_SECRETKEYSIZE Returns the number of bits in server certificate private key
CERT_SERIALNUMBER Returns the serial number field of the client certificate
CERT_SERVER_ISSUER Returns the issuer field of the server certificate
CERT_SERVER_SUBJECT Returns the subject field of the server certificate
CERT_SUBJECT Returns the subject field of the client certificate
CONTENT_LENGTH Returns the length of the content as sent by the client
CONTENT_TYPE Returns the data type of the content
GATEWAY_INTERFACE Returns the revision of the CGI specification used by the server
HTTP_<HeaderName> Returns the value stored in the header HeaderName
HTTP_ACCEPT Returns the value of the Accept header
HTTP_ACCEPT_LANGUAGE Returns a string describing the language to use for displaying content
HTTP_COOKIE Returns the cookie string included with the request
HTTP_REFERER Returns a string containing the URL of the page that referred the request to the current page using an <a> tag. If the page is redirected, HTTP_REFERER is empty
HTTP_USER_AGENT Returns a string describing the browser that sent the request
HTTPS Returns ON if the request came in through secure channel or OFF if the request came in through a non-secure channel
HTTPS_KEYSIZE Returns the number of bits in Secure Sockets Layer connection key size
HTTPS_SECRETKEYSIZE Returns the number of bits in server certificate private key
HTTPS_SERVER_ISSUER Returns the issuer field of the server certificate
HTTPS_SERVER_SUBJECT Returns the subject field of the server certificate
INSTANCE_ID The ID for the IIS instance in text format
INSTANCE_META_PATH The meta base path for the instance of IIS that responds to the request
LOCAL_ADDR Returns the server address on which the request came in
LOGON_USER Returns the Windows account that the user is logged into
PATH_INFO Returns extra path information as given by the client
PATH_TRANSLATED A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping
QUERY_STRING Returns the query information stored in the string following the question mark (?) in the HTTP request
REMOTE_ADDR Returns the IP address of the remote host making the request
REMOTE_HOST Returns the name of the host making the request
REMOTE_USER Returns an unmapped user-name string sent in by the user
REQUEST_METHOD Returns the method used to make the request
SCRIPT_NAME Returns a virtual path to the script being executed
SERVER_NAME Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs
SERVER_PORT Returns the port number to which the request was sent
SERVER_PORT_SECURE Returns a string that contains 0 or 1. If the request is being handled on the secure port, it will be 1. Otherwise, it will be 0
SERVER_PROTOCOL Returns the name and revision of the request information protocol
SERVER_SOFTWARE Returns the name and version of the server software that answers the request and runs the gateway
URL Returns the base portion of the URL


实例

您可以像这样来循环遍历所有的服务器变量:

<%
for each x in Request.ServerVariables
  response.write(x & "<br>")
next
%>

下面的实例演示了如何查明访问者浏览器的类型、IP 地址等等:

<html>
<body>
<p>
<b>You are browsing this site with:</b>
<%Response.Write(Request.ServerVariables("http_user_agent"))%>
</p>
<p>
<b>Your IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_addr"))%>
</p>
<p>
<b>The DNS lookup of the IP address is:</b>
<%Response.Write(Request.ServerVariables("remote_host"))%>
</p>
<p>
<b>The method used to call the page:</b>
<%Response.Write(Request.ServerVariables("request_method"))%>
</p>
<p>
<b>The server's domain name:</b>
<%Response.Write(Request.ServerVariables("server_name"))%>
</p>
<p>
<b>The server's port:</b>
<%Response.Write(Request.ServerVariables("server_port"))%>
</p>
<p>
<b>The server's software:</b>
<%Response.Write(Request.ServerVariables("server_software"))%>
</p>
</body>
</html>


ASP ServerVariables 集合

完整的 Request 对象参考手册
ASP ServerVariables 集合

ASP目录

1.ASP 简介
2.ASP 教程
3.在自己的 PC 上运行 ASP
4.ASP Session 对象
5.ASP Cookies
6.ASP 表单
7.ASP 程序
8.ASP 变量
9.ASP 语法
10.ASP Session 对象
11.ASP Application 对象
12.ASP Request 对象
13.ASP Response 对象
14.ASP 使用 CDOSYS 发送电子邮件
15.ASP Global.asa
16.ASP 引用文件
17.ASP Application 对象
18.ASP ASPError 对象
19.ASP Server 对象
20.ASP FileSystem 对象
21.ASP ADO
22.ASP Dictionary 对象
23.ASP Folder 对象
24.ASP File 对象
25.ASP Drive 对象
26.ASP TextStream 对象
27.ASP Content Linking
28.ASP Browser Capabilities
29.ASP AdRotator
30.ASP 实例
31.ASP 总结
32.ASP 快速参考
33.AJAX 数据库
34.ASP – AJAX 与 ASP
35.ASP Charset 属性
36.ASP CacheControl 属性
37.ASP Buffer 属性
38.ASP Cookies 集合
39.ASP Clear 方法
40.ASP BinaryWrite 方法
41.ASP AppendToLog 方法
42.ASP AddHeader 方法
43.ASP Status 属性
44.ASP Pics 属性
45.ASP IsClientConnected 属性
46.ASP ExpiresAbsolute 属性
47.ASP Expires 属性
48.ASP ContentType 属性
49.ASP BinaryRead 方法
50.ASP TotalBytes 属性
51.ASP ServerVariables 集合
52.ASP QueryString 集合
53.ASP Form 集合
54.ASP Cookies 集合
55.ASP Write 方法
56.ASP Redirect 方法
57.ASP Flush 方法
58.ASP End 方法
59.ASP LCID 属性
60.ASP CodePage 属性
61.ASP StaticObjects 集合
62.ASP Contents 集合
63.ASP Application_OnStart 和 Application_OnEnd 事件
64.ASP Lock 和 Unlock 方法
65.ASP Contents.RemoveAll 方法
66.ASP Contents.Remove 方法
67.ASP StaticObjects 集合
68.ASP Contents 集合
69.ASP GetLastError 方法
70.ASP Execute 方法
71.ASP CreateObject 方法
72.ASP ScriptTimeout 属性
73.ASP Session_OnStart 和 Session_OnEnd 事件
74.ASP Contents.RemoveAll 方法
75.ASP Contents.Remove 方法
76.ASP Abandon 方法
77.ASP Timeout 属性
78.ASP SessionID 属性
79.ASP CreateFolder 方法
80.ASP CopyFolder 方法
81.ASP CopyFile 方法
82.ASP BuildPath 方法
83.ASP Drives 属性
84.ASP ASPError 对象的属性
85.ASP URLEncode 方法
86.ASP Transfer 方法
87.ASP MapPath 方法
88.ASP HTMLEncode 方法
89.ASP GetDriveName 方法
90.ASP GetDrive 方法
91.ASP GetBaseName 方法
92.ASP GetAbsolutePathName 方法
93.ASP FolderExists 方法
94.ASP FileExists 方法
95.ASP DriveExists 方法
96.ASP DeleteFolder 方法
97.ASP DeleteFile 方法
98.ASP CreateTextFile 方法
99.ASP OpenTextFile 方法
100.ASP MoveFolder 方法