BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
Microsoft ASP
The Request.QueryString Property
The Request.Form Property
The Request.Cookies Property
The Request.ClientCertification Property
The Request.BinaryRead Method
The Request Object
The ObjectContext.SetComplete Method
The ObjectContext.SetAbort Method
The ObjectContext.OnTransactionCommit Event
The ObjectContext.OnTransactionAbort Event
The ObjectContext Object
The Application.StaticObjects Collection
The Application.Contents Collection
The Application.UnLock Method
The Application.Lock Method
The Application.Contents.RemoveAll() Method
The Application.Contents.Remove(name|index) Method
The Application.OnStart() Event
The Application.OnEnd() Event
The Application Object
<< LAMP
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :3387

 

The Request.ServerVariables Property

Introduction

The Request.ServerVariables property can be used to retrieve information about the predefined server variables. They can be sometimes very useful to show additional information. For example you could retrieve the current file name and use it in the form tag, so you when you change the filename it doesn’t affect the form tag.

Example

The following example shows the user browser and IP.

<%
            Response.Write "IP: " & Request.ServerVariables("REMOTE_ADDR") & "<br/>"
            Response.Write "Browser:" & Request.ServerVariables("HTTP_USER_AGENT") & "<br/>"
%>

Advanced Example

This is the ASP code to automatically output all the server variables 

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

Output

Server Variables

Name:

Description:

ALL_HTTP

This variable can be used to retrieve all HTTP headers. This variables places the HTTP_ prefix before the header name and the header name is always in capital.

ALL_RAW

This variable retrieves all headers in raw form. The values appear in the same as they are sent. It does not add a prefix like All_HTTP does.

APP_POOL_ID

This variable returns the name of the application pool that is running in IIS worker process. This variable is not available in IIS 5.1 or below. Running this server variable on IIS 6.0 returns: DefaultAppPool

APPL_MD_PATH

This variable can be used to retrieve the metabase path of the application. Running this on my localhost returns: APPL_MD_PATH: /LM/W3SVC/1/Root/ASP_Examples

APPL_PHYSICAL_PATH

This variable can be used to retrieve the physical path corresponding to the metabase path in APPL_MD_PATH. On my system when I run the asp examples for this reference, it returns:
APPL_PHYSICAL_PATH: C:\Simulate_D\Customers\TopXML\References\ASP_Examples\

AUTH_PASSWORD

This variable retrieves the password entered in the client's authentication dialog. This variable is available only if basic authentication is used.

AUTH_TYPE

This is the authentication method that the server uses to validate users when they access a protected script. If you are not using any authentication it will return: Negotiate.

AUTH_USER

This is the name of the user. Running this on my localhost returns: SONU_LAPTOP\sonu (in the format machinename\login)

CACHE_URL

This value returns the name of the URL. It is only used in ISAPI applications. This value can be only used for IIS 5.1 or below.

CERT_COOKIE

This is the unique ID from the client certificate. It is returned as a string.

CERT_FLAGS

CERT_FLAGS is a two-bit value, bit 0 and bit 1. Bit 0 returns 1 if the client certificate is available. If it's invalid then bit 1 returns 1.  Invalid means the issuer is not found in the list of verified certificate issuers that resides on the web server). Note that these two bit values correspond to ceCertPresent and ceUnrecognizedIssuer constants.

CERT_ISSUER

The issuer of the client certificate, if one exists. The value of this element is a comma-delimited string that contains the subfields for each of the possible subelements described in the Issuer element section of the ClientCertificate collection explanation earlier in this chapter. 

CERT_KEYSIZE

This value can be used to return the number of bits in a SSL connection.  For example 64 or 128.

CERT_SECRETKEYSIZE

This value can be used to return the number of bits in the server certificate.  For example 1024.

CERT_SERIALNUMBER

This value returns the serial number of the client certificate.

CERT_SERVER_ISSUER

This value returns the issuer field of the server.

CERT_SERVER_SUBJECT

This value returns the subject field of the server certificate.

CERT_SUBJECT

This value returns the subject field of the client certificate.  This returns a comma-delimited string containing the subfields described in the Subject element section of the ClientCertificate collection description.

CONTENT_LENGTH

This value returns the length of the content. Running this example on my localhost returns: 0

CONTENT_TYPE

This value returns the type of the content, which can be GET, POST or PUT.

GATEWAY_INTERFACE

This value returns the revision of the CGI specification used by the server. On my localhost it returns: CGI/1.1

HTTP_ [HeaderName] 

The value sent in the HTTP header called headername. To retrieve the value of any HTTP header not mentioned in this list (including custom headers), you must prefix the header name with HTTP_. Attempting to retrieve a nonexistent header returns an empty string, not an error.

HTTP_ACCEPT

This value returns the value of the accept header, which contains a list of accepted formats like: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel. On my system it returns: */*

HTTP_ACCEPT_LANGUAGE

This value returns the language, which is used for the content. On my system it returns en-us

HTTP_COOKIE

This value returns the cookie string. On my system it returns: _Tab_Admin_Preview0=True; _Module4_Visible=true; _Module335_Visible=true; .DOTNETNUKE=265948BAB1E6ACCDF503CBA5A4C12...

HTTP_REFERER

This value returns the original URL when a redirect has occurred. It can be used in website statistics to show the original URL from where the visitor came from.

HTTP_USER_AGENT

This value returns information about the client browser. On my system it returns: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SYMPA; MyIE2; SV1; .NET CLR 1.1.4322)

HTTPS

This value returns either ON if the request was made securely or OFF if the request came through a non-secure channel. When used on the URL http://www.topxml.com/default.asp the returned result is OFF. When used on the URL https://www.topxml.com/default.asp the returned result is ON.

HTTP_KEYSIZE

This value returns the number of bits in a SSL connection.

HTTP_SECRETKEYSIZE

This value can be used to return the number of bits in the server certificate.

HTTPS_SERVER_ISSUER

This value returns the issuer field of the server certificate.

HTTPS_SERVER_SUBJECT

This value returns the subject field of the server certificate.

INSTANCE_ID

This value returns the ID of the IIS instance. On my localhost it returns: 1

INSTANCE_META_PATH

This value is the meta base path for the instance of IIS that responds to a request. On my localhost it returns: /LM/W3SVC/1

LOCAL_ADDR

This value returns the server address on which the request came in. If you use localhost, then it will return: 127.0.0.1, but if you use the domain name then it will return the public IP.

LOGON_USER

This value returns the windows account that the user is logged in, regardless of the security type you are using (anonymous, basic, or Windows NT challenge/response). On my system it returns: SONU_LAPTOP\sonu

PATH_INFO

This value returns the extra path information. If yo use this variable on: http://sonu_laptop/mydir/test.asp then it will return: /mydir/test.asp

PATH_TRANSLATED

This value returns the translated version of the PATH_INFO from virtual to physical mapping.

QUERY_STRING

This value returns the query information stored in the string. When used on the URL: http://www.topxml.com/code/default.asp?p=3&id=v20040906064945&ms=10&l=&sw=All the returned result is only the querystring p=3&id=v20040906064945&ms=10&l=&sw=All 

REMOTE_ADDR

This value returns the remote IP address.

REMOTE_HOST

This value returns the remote host name.

REMOTE_USER

This value returns an unmapped username sent by the user.

REQUEST_METHOD

This value returns the method used to make the request, such as GET, POST, HEAD

SCRIPT_NAME

This value returns the virtual path of the script. When used on this url http://www.topxml.com/asp/default.asp it will return /asp/default.asp.

SERVER_NAME

This value returns the server’s hostname, DSN or IP. On http://www.topxml.com/default.asp  it returns www.topxml.com

SERVER_PORT

This value returns the port on which the request was sent. Usually its port 80.

SERVER_PORT_SECURE

This value returns the sting that contains either 0 or 1. 1 means that it is handled on a secure port and 0 means that it not a handled on a secure port. When used on the URL http://www.topxml.com/default.asp the returned result is 0. When used on the URL https://www.topxml.com/default.asp the returned result is 1.

SERVER_PROTOCOL

This value returns the name and revision about the request information protocol. On my system it returns HTTP/1.1.

SERVER_SOFTWARE

This value returns the name and version of the software that response to the request. I have installed IIS 5.1 and this variable returns Microsoft-IIS/5.1

URL

This value returns the base portion of the URL. When used on this url http://www.topxml.com/asp/default.asp it will return /asp/default.asp.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

A great opportunity to Digital Vide
here is a greate opportunity as a S
A great opportunity as a Network En
A Greate Opportunituy as a SQL Deve
An immediate job opportunity as a B

View all Jobs (Add yours)
View all CV (Add yours)



Information Online

swimming pool builder
chicago web site design
free conference call
Domain Names
masks
Donna karan sunglasses
answering service


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP