Asp Object: Response. Cookies

Source: Internet
Author: User
Cookies
Set the cookie value in the cookie set. If the specified cookie does not exist, create it. If yes, a new value is set and the old value is deleted.
Syntax Response. Cookies (Cookies) [(key) |. attribute] = value

Parameters
Cookie
The name of the cookie.
Key
Optional. If the key is specified, the cookie is a dictionary, and the key is set to value.
Attribute
Specify information about the cookie. Attribute can be one of the following:
Name
Description
Domain
Write only. If specified, the cookie will be sent to the request for this domain.
Expires
Write only. Cookie expiration date. This date must be set to store cookies on the client disk after the session ends. If the setting of this attribute does not exceed the current date, the cookie will expire after the task ends.
HasKeys
Read only. Specifies whether the cookie contains a keyword.
Path
Write only. If specified, the cookie will only be sent to the request for this path. If this attribute is not set, the application path is used.
Secure
Write only. Whether the cookie is secure.
Value
Specifies the value assigned to the key or attribute.
Note
If a cookie with a keyword is created, as shown in the following script, <%
Response. Cookies ("mycookie") ("type1") = "sugar"
Response. Cookies ("mycookie") ("type2") = "ginger snap"
%>

The title will be sent out. Set-Cookie: MYCOOKIE = TYPE1 = sugar & TYPE2 = ginger + snap

If no keyword is specified when myCookie is specified, type1 and type2. As shown in the following example. <% Response. Cookies ("myCookie") = "chocolate chip" %>

In the previous example, the keywords type1 and type2 are damaged and their values are also deleted. MyCookie cookie only contains the value of chocolate chip.
Otherwise, if you call a cookie with a keyword, it will destroy any value without a keyword contained in the cookie. For example, if you use the following statement to call Response. Cookies after the preceding code, <% Response. Cookies ("myCookie") ("newType") = "peanut butter" %>

The value of chocolate chip will be deleted and newType will be set to peanut butter.
To determine whether a cookie has a keyword, use the following syntax. <% = Response. Cookies ("myCookie"). HasKeys %>

If myCookie is a cookie dictionary, the previous value is TRUE. Otherwise, the value is FALSE.
You can set cookie attributes through loops. For example, to set all cookies to expire on a specific date, you can use the following syntax. <%

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.