Cookie|cookies|object|request|cookie
Cookies
The Cookies collection allows the user to retrieve the value of the cookie sent in the HTTP request.
Grammar
Request.Cookies (cookie) [(key) |. Attribute
Parameters
-
Cookies
-
Specifies the cookie whose value you want to retrieve.
-
Key
-
An optional parameter that retrieves the value of a subkey from the cookie dictionary.
-
Attribe
-
Specifies information about the cookie itself. Its property parameters are as follows: The name Description HasKeys read-only. Specifies whether the cookie contains keywords.
Comments
You can access the child keywords of the cookie dictionary by including a key value. If key is not specified when accessing the cookie dictionary, all keywords are returned as a single query string. For example, if MyCookie has two keywords, first and Second, and does not specify any of these keywords when calling Request.Cookies, the following string is returned.
If the client browser sends two cookies with the same name, then Request.cookie returns one of the deeper path structures. For example, if you have two cookies with the same name, but one of the path properties is/www/and the other is/www/home/, and the client browser sends two cookies to the/www/home/directory at the same time, Request.cookie will return only the second C Ookie.
To determine whether a cookie is a cookie dictionary (whether a cookie has keywords), use the following script.
False
If MyCookie is a cookie dictionary, the previous assignment is TRUE. Otherwise, FALSE.
You can iterate through all the cookies in the cookie collection or all the keywords in the cookie. However, traversing the keyword through a cookie without a keyword does not produce any output. You can avoid this situation by first checking the cookie for keywords using haskeys syntax. This is demonstrated in the following example.
Example
The following example prints the value of a mycookie in a Web page.
This is the cookie value named MyCookie:
Apply to
Request Object