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 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 & "
")
next
%>
for each x in request.servervariables
response.write(x & "
")
next
%>
下面的实例演示了如何查明访问者浏览器的类型、ip 地址等等:
you are browsing this site with:
<%response.write(request.servervariables("http_user_agent"))%>
your ip address is:
<%response.write(request.servervariables("remote_addr"))%>
the dns lookup of the ip address is:
<%response.write(request.servervariables("remote_host"))%>
the method used to call the page:
<%response.write(request.servervariables("request_method"))%>
the server's domain name:
<%response.write(request.servervariables("server_name"))%>
the server's port:
<%response.write(request.servervariables("server_port"))%>
the server's software:
<%response.write(request.servervariables("server_software"))%>
完整的 request 对象参考手册