Page 262 - DCAP408_WEB_PROGRAMMING
P. 262
Web Programming
Notes Request.Server Variables (Environment Variable Name)
List all server variables. ASP contains ASP code that lists all the items in the Request.
ServerVariables collection. The server variable collection contains both environment variables
and HTTP headers< both will be displayed when listing the contents of the collection.
Many environment variables do not contain a value. For example, the environment variables
prefixed with CERT all contain empty strings as their values. This is because these variables are
used only when the client and server use certificates. When a browser and web server communicate
over a secure channel, certificates are used to ensure the identity of the client to the server.
All environment variables do not have values all the times. When a web server is not using SSL,
the certificate environment variables are empty strings, much like the referrer HTTP header
contains an empty string when the page is not visited via a hyperlink. There are some that are
never empty such as URL, PATH_INFO, and PATH_ TRANSLATED
If you want to display the URL of the currently running ASP page, you would use the URL
environment variable. The URL environment variable does not show the http: web server name,
simply the full virtual path and filename. Another environment variable, Server_Name, contains
the actual host name of the web server. The SERVER_NAME environment variable can be used in
confection with the URL environment variable to retrieve the full URL of the ASP page.
Task What are environmental variables? Name some of the commonly used
environmental variables.
Self Assessment
Fill in the blanks:
1. Using ASP, one can read the headers that the browser sends to the web server using the
……………………..
2. A …………………….. is a single line of text that browser sends to the web server when
requesting to view any web page.
3. All environment variables do not have …………………….. all the times.
4. When a web server is not using SSL, the certificate environment variables are
…………………….. strings.
5. The URL environment variable does not show the http: web server name, simply the full
…………………….. and filename.
6. Response headers are additional bits of information about the …………………….. being
sent to the client.
7. The server variable collection contains both …………………….. and HTTP headers both
will be displayed when listing the contents of the collection.
11.3 Using Cookies
What are cookies? How to read Cookies, Using the Request Object, How to write Cookies using
the Response Object, Advantages and disadvantages of using cookies.
Cookies are a general mechanism which server side connections (such as CGI scripts) can use to
both store and retrieve information on the client side of the connection. The addition of a
256 LOVELY PROFESSIONAL UNIVERSITY