Page 261 - DCAP408_WEB_PROGRAMMING
P. 261

Unit 11: Using Request Objects




                                                                                                Notes

             Notes

            1.   Must prefix the name of the header with HTTP
            2.   How Request.ServerVariables (“ALL_HTTP) formats the list of HTTP headers. All
                 header names are capitalized and prefixed by HTTP_also, all dashes in the header
                 names are replaced with underscores, and the space between the colons at the value
                 of  the  header is removed. Request.ServerVariables (“ALL_RAW”) performs  no
                 formatting to the request headers.
            3.   Reference header is present if the page has reached through a hyperlink on a different
                 web page.




              Task  Give answers to following questions:
            1.   Explain what a HTTP header is. Name some of the standard HTTP headers.

            2.   Explain how HTTP headers are read with Request.ServerVariables.

          11.2 Accessing Environmental Variables


          Useful  Environment  Variables,  Reading  the  Environment  Variables,  Using  Request,
          ServerVariables.

          The HTTP headers are useful for obtaining information about the current visitor but tell nothing
          about the web server or the asp page that is being requested by the client.
          Environmental variables are bits of information that the web server makes available to any
          program that requests them. Environmental variables contain information such as the name of
          the web server, the URL of the currently processing ASP page, or the name of the name of the
          web server software being used.

          Commonly used Environment Variables

                 Environment Variables                    Description
             URL                         the URL of the ASP page from after
                                         http\\www.your.webserver.com/up to the query string.
             Path_info                   the same as the URL environment variable
             Path_translated             the full, physical path of the currently executing ASP page.
             Appl_physical_path          the physical address of the web’s root directory
             Query_string                the query string (equivalent to request every string)
             Server_name                 the web server’s computer name
             Server_software             the name of the web software

          Reading Environmental Variables using Request. Server Variables

          The  environmental  variables  are  accessed  much  like  the  HTTP  headers.  The  Request.
          ServerVariables collection is used in the following format:




                                           LOVELY PROFESSIONAL UNIVERSITY                                   255
   256   257   258   259   260   261   262   263   264   265   266