|
||
|
|
Response.Cookies | |
|
Objective
|
Store user-specific information on the client computer.
If there's a cookie with the same name, the cookie takes the new value set by your script. The syntax for setting cookies is: |
|
|
The key lets you create cookies with keys (nested cookies), as we did for setting user preferences in a previous example: |
||
| You can also specify an attribute, such as an expiration date, for each cookie or key value. | ||
|
Creating and updating cookies |
||
|
We could also have set the values in the cookies by using data from a submitted HTML FORM in this way: |
||
.
.
<%= Response.Cookies("Preferences")("Size") =
Request.Form("Size")%>
<%= Response.Cookies("Preferences")("Neck") =
Request.Form("Neck")%>
.
.
|
||
| Creating cookies with and without keys | ||
<% Response.Cookies("Name") = Request.Form("Name")%>
<% Response.Cookies("Preferences")("Size") =
Request.Form("Size") %>
|
||
| For the first cookie, there are no keys, so just the cookie is given: Name. In the second line, the Preferences cookie has several keys, including Size. | ||
|
The next lesson describes how to direct the user to a different Web page. |
||
|
|
||