Page 269 - DCAP408_WEB_PROGRAMMING
P. 269

Unit 11: Using Request Objects




              The environmental variables are accessed much like the HTTP headers. ASP contains ASP  Notes
               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.

              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. There are some that are
               never empty such as URL, PATH_INFO, and PATH_ TRANSLATED.
              URL environmental variable is used to display the URL of the currently running ASP
               page. 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.

              Cookies are a general mechanism which server side connections can use to both store and
               retrieve information on the client side of the connection.
              A server,  when returning an HTTP object to  a client,  may also  send a  piece of  state
               information which the client will store and included in that state object is a description of
               the range of URLs for which that state is valid. Any future HTTP requests made by the
               client, which fall in that range will include a transmittal of the current value of the state
               object from the client, back to the server. The state object is called a cookie. This simple
               mechanism provides a powerful new tool, which enables a host of new types of applications
               to be written for web-based environments.
              A cookie is introduced to the client by including a Set-Cookie header as part of an HTTP
               response. Syntax of the Set-Cookie HTTP Response Header is the format a CGI  script
               would use to add to the HTTP headers a new piece of data which is to be stored by the
               client for later retrieval.
              If a cookie is marked secure, it will only be transmitted if the communications channel
               with the host is a secure one. If secure is not specified, a cookie is considered safe to be sent
               in the clear over unsecured channels.
              When requesting a URL from an HTTP server, the browser will match the URL against all
               cookies and if any of them match, a line containing the name/value pairs of all matching
               cookies will be included in the HTTP request.

          11.5 Keywords


          Cookies: Cookies are a general mechanism which server side connections can use to both store
          and retrieve information on the client side of the connection.

          Environmental Variables: Environmental variables are bits of information that the web server
          makes available to any program that requests them.
          HTTP Header: A HTTP header is a single piece of information, sent either from the client to the
          server or from the server to the client, when requesting a page. Thus, it includes both the request
          headers and the response headers.
          HTTP: Hypertext Transfer Protocol, which is an application level protocol.




                                           LOVELY PROFESSIONAL UNIVERSITY                                   263
   264   265   266   267   268   269   270   271   272   273   274