All the friends who have been on the net know that cookies, known as the "cookie" of this network technology. Cookies are a small Che Wen that the server sends to the client.
This handle, the Web site by sending cookies to the viewer method to store some specific information on the user's local hard drive, waiting for users to visit the site again can
Read the stored information from the hard drive to complete some actions, such as a website that allows visitors to customize the page to "remember" the user with the Cookies technology
Custom hobby, and some e-commerce sites are also widely used cookies.
People's "Doubt", many browsers have provided the option to block cookies.
Perhaps you think that cookies technology is difficult to achieve, in fact, please see the following example, this example is mainly through cookies to make the site "remember" visitors
Some personal information, such as name, age, etc., so that when a visitor logs on to the site again, the site can display some of the visitors
Welcome information, such as "So-and-So, hello", is not very kind?
Response.Cookies ("Information") ("name") =request.form ("name")
Response.Cookies ("Information") ("Age") =request.form ("Age")
Response.Cookies ("Information") ("Nation") =request.form ("Nation")
<form method= "POST" action= "enrol.asp" >
<input type= "text" name= "name" >
<input type= "text" name= "age" >
Nation:<input type= "text" name= "Nation" >
<input type= "Submit" >
<input type= "Reset" >
The code is an ASP program, but is essentially a text file, so you can use the "notepad" edit, the other local debugging needs PWS4.0, the above code to save into
ASP file, named Enrol.asp, save path C:\Inetpub\wwwroot (PWS default installation).
The program defines a cookie dictionary, named information, with three subkeys: Name, age, and nation, which are used to record the visitor's last name, respectively.
Name, age and country, if you still need more information on your visitors, you can define more subkeys.
Run PWS, open the browser, enter http://localhost/enrol.asp in the Address bar, and a form appears asking visitors to fill out their personal information when
After the visitor has completed submitting the form, his personal data is stored on the user's hard drive by cookies, which is available for the next time the website reads, the following
ASP file demonstrates how to read information from cookies in the process, the ASP file save path with enrol.asp, file name is feedback.asp, run
When you type http://localhost/feedback.asp in the browser's address bar, the contents of the cookies are displayed on the page.
<%=request.cookies ("Information") ("name")%>
<%=request.cookies ("Information") ("Age")%>
<%=request.cookies ("Information") ("Nation")%>