Home | » | ASP | » | The Request Object |
The Request Object is useful for reading form field values. However, the Request Object is not limited to form processing.
Contents
- What HTTP header are
- Reading the HTTP Headers with Request.ServerVariables
- Reading the Environment Variables Using Request.ServerVariables
- Contains all the HTTP Headers & Environment Variables
- What Cookies are
- How to read cookies using the Request Object
- How to write cookies using the Response Object
- Using the Cookies
- Using the Keys (SubCookies)
What HTTP header are
When the clients requests a Web page from the server, it not only sends the URL of the Web page requested but also some additional information. This extra information consists of useful facts about the client. For example, this added information can include what browser is being used, what operating system the client is running, and what URL the user just came from. Each piece of additional information is referred to as a request header.
When the server sends back the requested Web page to the client, it also sends a set of headers, known as response headers. Response headers are additional bits of information about the Web page being sent to the client. Both the request headers and the response headers are referred to , more generally, as HTTP headers.
An HTTP header is a single piece of information, sent either from the client to the server, when requesting a page, or from the server to the client, when responding to a page request.
Reading the HTTP Headers with Request.ServerVariables
Reading the Environment Variables Using Request.ServerVariables
Contains all the HTTP Headers & Environment Variables
HTTP Headers & Envrionment Variables - Demo
What Cookies are
Cookies are small bits of information, such as strings and numeric values, stored on the client's computer for a specified amount of time. When cookies are created on the client's computer, the developer needs to specify when they expire. After a cookie expires, it will automatically remove itself from the client's computer.
How to read cookies using the Request Object
Cookies are stored and read using the HTTP headers. Each time the browser requests a Web page, it sends the cookies that the current Web site created. You can use the Cookies HTTP header to read the cookies. For example, if you create an ASP page on your Web server that contains the following code:
How to write cookies using the Response Object
Now that you know how to read cookies from the client's computer, it's about time that you learn how to write them. the HTTP headers that the Web server sends to the browser before it sends the actual Web page requested by the client. Cookies are written to the client's computer through the use of response headers. Therefore, it's not surprising to find that cookies are written to the browser using the Response object.
The Response object, like the Request object, has Cookies collection. The following code writes a cookie to the client's computer:
Blogger Comment
Facebook Comment