ASP ServerVariables Collection

|  | Search W3Schools : |

HOME | HTML | CSS | XML | JAVASCRIPT | ASP | PHP | SQL | MORE... |  | References | Examples | Forum | About

ADVERTISEMENTS XML Certification Download XML editor Custom Programming |  |

Table of contents

ASP Tutorial
ASP HOME
ASP Introduction
ASP Install
ASP Syntax
ASP Variables
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Objects
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary
ASP ADO
ASP Components
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator
ASP Quick Ref
ASP Summary
Examples/Quiz
ASP Examples
ASP Quiz
ASP Exam

Selected Reading

Web Statistics
Web Glossary
Web Hosting
Web Quality
W3Schools Tutorials
W3Schools Forum
Helping W3Schools

# ASP ServerVariables Collection

Complete Request Object Reference

The ServerVariables collection is used to retrieve the server variable values.

### Syntax

    Request.ServerVariables (server_variable)

Parameter | Description
--- | ---
server_variable | Required. The name of the server variable to retrieve

### Server Variables

Variable | Description
--- | ---
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

### Examples

Example 1

You can loop through all of the server variables like this:

    <%
    for each x in Request.ServerVariables
      response.write(x & "<br />")
    next
     %>

Example 2

This example demonstrates how to find out the visitor's browser type, IP address, and more:

    <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>

Complete Request Object Reference

## Altova® XMLSpy® - The world's best-selling XML editor!

Whether you're new to XML or already an advanced user, the user-friendly views and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to meet your XML and Web services development needs from start to finish.

- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!

Download a fully functional free 30-day trial today!

WEB HOSTING
ASP.NET Shopping Cart
$15 Domain Name Registration Save $20 / year!
Buy UK Domain Names Register Domain Names
Cheap Domain Names Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting

WEB BUILDING
Website Templates Flash Templates Website Builder Internet Business Opportunity
Custom Programming
FREE Trial or Demo Web Content Manager Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates

EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

HOME or Top of Page |  | Printer Friendly
W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy. Copyright 1999-2009 by Refsnes Data. All Rights Reserved.