Server Variables
How to get the server variables
Server variables are environment variables that tell you about the environment that your application is running in. True you can find all kinds of information in the server variables, everything from what browser your user is browsing with to what type of server software your host is running.
Browser Detect How To
Here is an example of how to get a server variable:
Place in quotes the name of the server variable you want to see.
Below is a list of the server variables and there descriptions: Server Variables
ALL_HTTP HTTP Headers from client
ALL_RAW Raw HTTP Headers from client
APPL_MD_PATH Metabase path for the ISAPI DLL
APPL_PHYSICAL_PATH Physical path to the metabase
AUTH_PASSWORD What the user entered in the client's authentication dialog
AUTH_TYPE Authentication the server used
AUTH_USER Authenticated user name
CERT_COOKIE Unique ID of the client certificate
CERT_FLAGS Is client certification valid?
CERT_ISSUER Issuer of the client certificate
CERT_KEYSIZE Number of bits in the SSL key
CERT_SECRETKEYSIZE Number of bits in the secret key
CERT_SERIALNUMBER Serial Number for the client certificate
CERT_SERVER_ISSUER Issuer of the the server certificate
CERT_SERVER_SUBJECT Subject of the server certificate
CERT_SUBJECT Subject of the client certificate
CONTENT_LENGTH Length of the content
CONTENT_TYPE MIME type of the current page
GATEWAY_INTERFACE CGI version from server
HTTPS Is this secure through SSL?
HTTPS_KEYSIZE Number of bits in the SSL key
HTTPS_SECRETKEYSIZE Number of bits in the secret key
HTTPS_SERVER_ISSUER Issuer of the server certificate
HTTPS_SERVER_SUBJECT Subject of the server certificate
INSTANCE_ID ID for this instance in IIS
INSTANCE_META_PATH Metabase path for this instance
LOCAL_ADDR IP of server
LOGON_USER NT login for current user
PATH_INFO Server virtual path
PATH_TRANSLATED Server absolute path
QUERY_STRING Variable name value pairs from the url string
REMOTE_ADDR Client IP address for requesting machine
REMOTE_HOST Client IP address for requesting host
REMOTE_USER Remote User
REQUEST_METHOD Method of request
SCRIPT_NAME virtual path and file name of current script
SERVER_NAME Server name
SERVER_PORT Port being accessed
SERVER_PORT_SECURE 0=not secure, 1=secure
SERVER_PROTOCOL Name/Version of protocol used
SERVER_SOFTWARE HTTP software used on the server
URL URL without the domain name
HTTP_ACCEPT MIME types the browser knows
HTTP_ACCEPT_LANGUAGE Browser's language setting
HTTP_CONNECTION HTTP Connection
HTTP_HOST Domain hosting this request
HTTP_USER_AGENT Browser being used
HTTP_PRAGMA Cache page or not?
HTTP_COOKIE Cookie related to this page
HTTP_ACCEPT_CHARSET ISO character set being accepted
Bolded items are available in IIS 4.0 only. The best way to find out if you can use one of the above items is to print it out and run some tests on it's output.
Server variables are environment variables that tell you about the environment that your application is running in. True you can find all kinds of information in the server variables, everything from what browser your user is browsing with to what type of server software your host is running.
Browser Detect How To
Here is an example of how to get a server variable:
- Code: Select all
Response.Write(Request.ServerVariables("ALL_HTTP"))
Place in quotes the name of the server variable you want to see.
Below is a list of the server variables and there descriptions: Server Variables
ALL_HTTP HTTP Headers from client
ALL_RAW Raw HTTP Headers from client
APPL_MD_PATH Metabase path for the ISAPI DLL
APPL_PHYSICAL_PATH Physical path to the metabase
AUTH_PASSWORD What the user entered in the client's authentication dialog
AUTH_TYPE Authentication the server used
AUTH_USER Authenticated user name
CERT_COOKIE Unique ID of the client certificate
CERT_FLAGS Is client certification valid?
CERT_ISSUER Issuer of the client certificate
CERT_KEYSIZE Number of bits in the SSL key
CERT_SECRETKEYSIZE Number of bits in the secret key
CERT_SERIALNUMBER Serial Number for the client certificate
CERT_SERVER_ISSUER Issuer of the the server certificate
CERT_SERVER_SUBJECT Subject of the server certificate
CERT_SUBJECT Subject of the client certificate
CONTENT_LENGTH Length of the content
CONTENT_TYPE MIME type of the current page
GATEWAY_INTERFACE CGI version from server
HTTPS Is this secure through SSL?
HTTPS_KEYSIZE Number of bits in the SSL key
HTTPS_SECRETKEYSIZE Number of bits in the secret key
HTTPS_SERVER_ISSUER Issuer of the server certificate
HTTPS_SERVER_SUBJECT Subject of the server certificate
INSTANCE_ID ID for this instance in IIS
INSTANCE_META_PATH Metabase path for this instance
LOCAL_ADDR IP of server
LOGON_USER NT login for current user
PATH_INFO Server virtual path
PATH_TRANSLATED Server absolute path
QUERY_STRING Variable name value pairs from the url string
REMOTE_ADDR Client IP address for requesting machine
REMOTE_HOST Client IP address for requesting host
REMOTE_USER Remote User
REQUEST_METHOD Method of request
SCRIPT_NAME virtual path and file name of current script
SERVER_NAME Server name
SERVER_PORT Port being accessed
SERVER_PORT_SECURE 0=not secure, 1=secure
SERVER_PROTOCOL Name/Version of protocol used
SERVER_SOFTWARE HTTP software used on the server
URL URL without the domain name
HTTP_ACCEPT MIME types the browser knows
HTTP_ACCEPT_LANGUAGE Browser's language setting
HTTP_CONNECTION HTTP Connection
HTTP_HOST Domain hosting this request
HTTP_USER_AGENT Browser being used
HTTP_PRAGMA Cache page or not?
HTTP_COOKIE Cookie related to this page
HTTP_ACCEPT_CHARSET ISO character set being accepted
Bolded items are available in IIS 4.0 only. The best way to find out if you can use one of the above items is to print it out and run some tests on it's output.