Cookies
The cookie set allows you to retrieve the cookie value sent in an HTTP request.
Syntax Request. Cookies (Cookies) [(key) |. attribute]
Parameters
Cookie
Specifies the cookie for which the value is to be retrieved.
Key
Optional. Used to retrieve the value of a subkeyword from the cookie Dictionary.
Attribe
Specify information about the cookie. Its attribute parameters are as follows:
Name
Description
HasKeys
Read-only. Specifies whether the cookie contains a keyword.
Note
You can access the subkeywords of the cookie Dictionary by including a key value. If no key is specified when you access the cookie dictionary, all keywords are returned as a single query string. For example, if MyCookie has two keywords: First and Second, and no keyword is specified when Request. Cookie is called, the following string is returned. First = firstkeyvalue & Second = secondkeyvalue
If the client browser sends two cookies with the same name, the Request. cookie returns a deeper path. For example, if there are two cookies with the same name, but one of the path attributes is/www/and the other is/www/home /, the client browser sends both cookies to the/www/home/directory. only the second Cookie is returned.
To determine whether a cookie is a cookie Dictionary (whether a cookie has a keyword), use the following script. False
If myCookie is a cookie dictionary, the previous value is TRUE. Otherwise, the value is FALSE.
You can traverse all Cookies in the cookie set or all keywords in Cookies cyclically. However, retrieving a cookie without a keyword does not produce any output. Use the HasKeys syntax to check whether the cookie has a keyword. This can be avoided. The example below demonstrates this.
Example
The following example prints the value of myCookie on the Web page. This is the cookie value named myCookie:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.