Verzeichnis suchen
ASP 基础教程 在自己的 PC 上运行 ASP ASP 基本语法规则 ASP 变量 ASP 子程序 ASP 表单和用户输入 ASP Cookies ASP Session 对象 ASP Application 对象 ASP 引用文件 ASP Global.asa 文件 ASP 使用 CDOSYS 发送电子邮件 ASP 对象 ASP Response 对象 ASP Cookies 集合 ASP Buffer 属性 ASP CacheControl 属性 ASP Charset 属性 ASP ContentType 属性 ASP Expires 属性 ASP ExpiresAbsolute 属性 ASP IsClientConnected 属性 ASP PICS 属性 ASP Status 属性 ASP AddHeader 方法 ASP AppendToLog 方法 ASP BinaryWrite 方法 ASP Clear 方法 ASP End 方法 ASP Flush 方法 ASP Redirect 方法 ASP Write 方法 ASP Request 对象 ASP Cookies 集合 ASP Form 集合 ASP QueryString 集合 ASP ServerVariables 集合 ASP 教程 ASP TotalBytes 属性 ASP BinaryRead 方法 ASP Application 对象 ASP Contents 集合 ASP StaticObjects 集合 ASP Contents.RemoveAll 方法 ASP Lock 和 Unlock 方法 ASP Application OnStart 和 Application OnEnd 事件 ASP Session 对象 ASP Contents 集合 ASP StaticObjects 集合 ASP CodePage 属性 ASP LCID 属性 ASP SessionID 属性 ASP Timeout 属性 ASP Abandon 方法 ASP Contents.Remove 方法 ASP Contents.RemoveAll 方法 ASP Session OnStart 和 Session OnEnd 事件 ASP ScriptTimeout 属性 ASP CreateObject 方法 ASP Execute 方法 ASP Server 对象 ASP GetLastError() 方法 (ASP 3.0) ASP HTMLEncode 方法 ASP MapPath 方法 ASP Transfer 方法 ASP URLEncode 方法 ASP ASPError 对象 ASP ASPError 对象的属性 ASP FileSystemObject 对象 ASP Drives 属性 ASP BuildPath 方法 ASP CopyFile 方法 ASP CopyFolder 方法 ASP CreateFolder 方法 ASP CreateTextFile 方法 ASP DeleteFile 方法 ASP DeleteFolder 方法 ASP DriveExists 方法 ASP FileExists 方法 ASP FolderExists 方法 ASP GetAbsolutePathName 方法 ASP GetBaseName 方法 ASP GetDrive 方法 ASP GetDriveName 方法 ASP GetExtensionName 方法 ASP GetFile 方法 ASP GetFileName 方法 ASP GetFolder 方法 ASP GetParentFolderName 方法 ASP GetSpecialFolder 方法 ASP GetTempName 方法 ASP MoveFile 方法 ASP MoveFolder 方法 ASP OpenTextFile 方法 ASP TextStream 对象 ASP AtEndOfLine 属性 ASP AtEndOfStream 属性 ASP Column 属性 ASP Line 属性 ASP Close 方法 ASP Read 方法 ASP ReadAll 方法 ASP ReadLine 方法 ASP Skip 方法 ASP SkipLine 方法 ASP Write 方法 ASP WriteLine 方法 ASP WriteBlankLines 方法 ASP Drive 对象 ASP AvailableSpace 属性 ASP DriveLetter 属性 ASP DriveType 属性 ASP FileSystem 属性 ASP FreeSpace 属性 ASP IsReady 属性 ASP Path 属性 ASP RootFolder 属性 ASP SerialNumber 属性 ASP ShareName 属性 ASP TotalSize 属性 ASP VolumeName 属性 ASP File 对象 ASP Attributes 属性 ASP DateCreated 属性 ASP DateLastAccessed 属性 ASP DateLastModified 属性 ASP Drive 属性 ASP Name 属性 ASP ParentFolder 属性 ASP Path 属性 ASP ShortName 属性 ASP ShortPath 属性 ASP Size 属性 ASP Type 属性 ASP Copy 方法 ASP Delete 方法 ASP Move 方法 ASP OpenAsTextStream 方法 ASP Folder 对象 ASP Files 集合 ASP SubFolders 集合 ASP Attributes 属性 ASP DateCreated 属性 ASP DateLastAccessed 属性 ASP DateLastModified 属性 ASP Drive 属性 ASP IsRootFolder 属性 ASP Name 属性 ASP ParentFolder 属性 ASP Path 属性 ASP ShortName 属性 ASP ShortPath 属性 ASP Size 属性 ASP Type 属性 ASP Copy 方法 ASP Delete 方法 ASP Move 方法 ASP CreateTextFile 方法 ASP Dictionary 对象 ASP CompareMode 属性 ASP Count 属性 ASP Item 属性 ASP Key 属性 ASP Add 方法 ASP Exists 方法 ASP Items 方法 ASP Keys 方法 ASP Remove 方法 ASP RemoveAll 方法 ASP ADO ASP 组件 ASP AdRotator 组件 ASP Browser Capabilities 组件 ASP Content Linking 组件 ASP Content Rotator 组件 (ASP 3.0) ASP 与 AJAX AJAX 简介 ASP - AJAX 与 ASP AJAX 数据库实例 ASP 实例 ASP 实例 ASP 快速参考
Figuren

ASP ServerVariables 集合




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>

Vorheriger Artikel: Nächster Artikel: