[Request environment variable] ServerVariables

Source: Internet
Author: User
Tags servervariables metabase
ServerVariables set

ServerVariablesSet to retrieve predefined Environment Variables

Syntax
Request.ServerVariables (server environment variable)
Parameters

Server environment variable
Name of the server environment variable to be retrieved

Function

Server environment variableIndicates the name of the server environment variable to be retrieved, which can be the following:

ALL_HTTP All HTTP header files sent by the client.
ALL_RAW Retrieve all titles in the unprocessed table. Different from ALL_RAW, ALL_HTTP puts HTTP _ prefix before the title file name, and the title name is always capitalized. When ALL_RAW is used, the title name and value only appear when the client sends them.
APPL_MD_PATH Retrieve the metadatabase path of the isapi dll (WAM) Application.
APPL_PHYSICAL_PATH Search for the physical path corresponding to the metabase path. IIS converts APPL_MD_PATH to a physical (directory) path to return values.
AUTH_PASSWORD Enter this value in the authentication dialog box of the client. This variable is available only when basic authentication is used.
AUTH_TYPE When a user accesses a protected script, the server is used to verify the user's authentication method.
AUTH_USER Unauthenticated User Name.
CERT_COOKIE The unique ID verified by the client, which is returned as a string. It can be used as a signature for verification by the entire client.
CERT_FLAGS If a client is verified, bit0 is 1.

If the authenticated by the client is invalid (not in the CA list recognized by the server), bit1 is set to 1.

CERT_ISSUER The issuer field in user verification (O = MS, OU = IAS, CN = user name, C = USA ).
CERT_KEYSIZE Number of digits of the Secure Socket Layer connection keyword, such as 128.
CERT_SECRETKEYSIZE The number of digits that the server verifies for a private keyword. For example, 1024.
CERT_SERIALNUMBER The serial number field verified by the user.
CERT_SERVER_ISSUER The issuer field for server verification.
CERT_SERVER_SUBJECT Master field verified by the server.
CERT_SUBJECT The main field verified by the client.
CONTENT_LENGTH The length of the content sent by the client.
CONTENT_TYPE The data type of the content. It is used together with the query of additional information, such as HTTP query GET, POST, and PUT.
GATEWAY_INTERFACE Modify the CGI specification used by the server. The format is CGI/revision.
HTTP _ <HeaderName> HeaderNameThe value stored in the title file. The title file not included in the table must be prefixed with HTTP _ServerVariablesSet to retrieve its value.

Note:Server Load balancerHeaderNameThe underscore (_) in is interpreted as the break number in the actual title. For example, if you specify HTTP_MY_HEADER, the server searches for the title file sent in the name of MY-HEADER.

HTTPS If the request passes through the Secure Channel (SSL), ON is returned. If the request comes from an insecure channel, return OFF.
HTTPS_KEYSIZE Number of digits of the Secure Socket Layer connection keyword, such as 128.
HTTPS_SECRETKEYSIZE The number of digits that the server verifies for a private keyword. For example, 1024.
HTTPS_SERVER_ISSUER The issuer field for server verification.
HTTPS_SERVER_SUBJECT Master field verified by the server.
INSTANCE_ID The ID of the text-formatted IIS instance. If the instance ID is 1, it appears as a character. You can use this variable to retrieve the ID of the Web server instance to which the request belongs (in the metabase.
INSTANCE_META_PATH The metabase path of the IIS instance that responds to the request.
LOCAL_ADDR Returns the server address that receives the request. This variable is very important if you look for the address used by the request on a multi-host machine bound with multiple IP addresses.
LOGON_USER Log on to the Windows NT account.
PATH_INFO The additional path information provided by the client. You can use these virtual paths and the PATH_INFO server variable to access the script. If the information comes from the URL, It is decoded by the server before it reaches the CGI script.
PATH_TRANSLATED The version converted by PATH_INFO. The variable obtains the path and performs necessary ing from virtual to physical.
QUERY_STRING Query question marks (?) in an HTTP request (?) .
REMOTE_ADDR The IP address of the remote host that sends the request.
REMOTE_HOST The name of the host that sent the request. If the server does not have this information, it will set the MOTE_ADDR variable to null.
REMOTE_USER Unmapped user name string sent by the user. The name is the name actually sent by the user, which is opposite to the name modified by the server verification filter.
REQUEST_METHOD This method is used to submit a request. It is equivalent to GET, HEAD, POST, and so on for HTTP.
SCRIPT_NAME The virtual path for executing the script. The URL used for self-reference.
SERVER_NAME The server host name, DNS alias, or IP address that appears in the Self-referenced UAL.
SERVER_PORT The port number for sending the request.
SERVER_PORT_SECURE String that contains 0 or 1. If the security port processes the request, it is 1; otherwise, it is 0.
SERVER_PROTOCOL Name and revision of the Request Information Protocol. Format:Protocol/Revision.
SERVER_SOFTWARE Name and version of the server software that responds to the request and runs the gateway. Format:Name/Version.
URL Provide the basic part of the URL.
Note

If the title file sent by the client cannot be found in the preceding table, you can callRequest. ServerVariablesAdd the prefix of HTTP _ to the title file name to retrieve its value. For example, if the client sends a title File

SomeNewHeader:SomeNewValue

You can use the following syntax to retrieve SomeNewValue

<% Request.ServerVariables("HTTP_SomeNewHeader") %>

You can use repeat characters to traverse all server variable names cyclically. For example, use the following script to print all server names.

<TABLE>
<TR><TD><B>Server Variable</B></TD><TD><B>Value</B></TD></TR>
<% For Each name In Request.ServerVariables %>
<TR><TD> <%= name %> </TD><TD> <%= Request.ServerVariables(name) %> </TD></TR>
</TABLE>
<% Next %>
Example

The following example usesRequestThe object displays some server variables.

<HTML>
<!-- This example displays the content of several ServerVariables. -->
ALL_HTTP server variable =
<%= Request.ServerVariables("ALL_HTTP") %> <BR>
CONTENT_LENGTH server variable =
<%= Request.ServerVariables("CONTENT_LENGTH") %> <BR>
CONTENT_TYPE server variable =
<%= Request.ServerVariables("CONTENT_TYPE") %> <BR>
QUERY_STRING server variable =
<%= Request.ServerVariables("QUERY_STRING") %> <BR>
SERVER_SOFTWARE server variable =
<%= Request.ServerVariables("SERVER_SOFTWARE") %> <BR>
</HTML>

Next exampleServerVariablesThe Set inserts a hypertext link into the server name.

<A HREF = "http://<%= Request.ServerVariables("SERVER_NAME") %>
/scripts/MyPage.asp">Link to MyPage.asp</A>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.