We will make a page that remembers the visitor's name, and in this small case you will learn how to use the values of the Request object's cookies, form, and ServerVariables collection, and learn how to use the Response object to send cookies.
First take a look at the program code:
<% @LANGUAGE = "VBSCRIPT" codepage= "65001"%><!doctype html>
First run, unable to get Cookies information, display the form, let the user submit, such as:
Submit a form, or post to the current ASP page, because you still can't get cookies, so display the page that submitted the form successfully, such as:
Refresh the current page requestcookies.asp again, as you can get a cookie to display the visitor's name directly.
We explain in detail the part that lets the user enter the name and save, first get the value of the ServerVariables variable Request_method, which identifies the current page request method, if it is the post method, it is now thinking this page to submit a form, This is the time to get the value of the form and use the Response.Cookies collection to output cookies to the client, otherwise display the HTML code for the user to fill in the name.
Small knowledge
The Trim function removes spaces on either side of the string, theLTrim function deletes the left space of the string, and theRTrim function removes the right space.
The UCase function converts the specified string to uppercase, and theLCase function converts the specified string to lowercase.
"Recommended"
1. summarize the use instance of the Request object for ASP .
2. talk about the use of the two objects: request and Response
3. sharing the Request object in ASP five methods to obtain client data
4.