Name
Cookies —
Response.Cookies.Item(
Key
)[(
SubKey
) |
.attribute
]
=
strCookieValue
Synopsis
The
Cookies
collection of the Response object enables your ASP application to use
the Set-Cookie
HTTP response header to write
cookies to the client's machine. If you attempt to set the
value of a cookie that does not yet exist, it is created. If it
already exists, the new value you set overwrites the old value
already written to the client machine.
As with the Cookies collection of the Request object, each cookie in the Cookies collection of the Response object can also represent a cookie dictionary. Recall from Chapter 7, that a cookie dictionary is a construct that is similar to an associative array in that each element of the array is identifiable by its name. For more information on cookie dictionaries, see the section on the Cookies collection of the Request object in Chapter 7.
The Cookies collection of the Response object, like other ASP collections, has the following properties:
- Item
Returns the value of a specific element in the collection. To specify an item, you can use an index number or a key.
- Key
Returns the name of a specific element in the Cookies collection. Just as each element's value is represented by the Item property, so each element's name is represented by its Key property.
If you do not know the name of a specific key, you can obtain it using its ordinal reference. For example, assume that you want to learn the key name for the third element in the collection and, ...
Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.