目录搜索
ASP 基础教程在自己的 PC 上运行 ASPASP 基本语法规则ASP 变量ASP 子程序ASP 表单和用户输入ASP CookiesASP 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 ADOASP 组件ASP AdRotator 组件ASP Browser Capabilities 组件ASP Content Linking 组件ASP Content Rotator 组件 (ASP 3.0)ASP 与 AJAXAJAX 简介ASP - AJAX 与 ASPAJAX 数据库实例ASP 实例ASP 实例ASP 快速参考
文字

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>

上一篇:下一篇: