About the use of cookies

Source: Internet
Author: User

Properties of the cookie

Domain: Domains, that is, the scope of the cookie can be used, of course, the current domain can be under the current domain cookie, and one is the domain name of the parent domain name (the child domain name is access to the parent domain name under the cookie, A parent domain name is a cookie that cannot be accessed without processing a child domain name)

Path: This parameter also controls the access of the cookie, if the current path=/admin/welcome/path, when you access the same domain name under the/admin/goout/path of the page you are not accessible, so generally we will be set to Path= "/", This allows us to access this cookie under the entire domain name and has not encountered a different path.

Maxage:cookie the effective time, not set, the effective time will be closed with the browser to expire, set the words will of course live according to your requirements. Delete a cookie to set the cookie's validity period: Current time-1, now it's dead.

Attention:

1, Request.getcookies () may return a null value.

2. New cookie The default path is to create his request path, which is not available in other paths. If you want to use this cookie throughout your site, you need to manually specify path using Cookie.setpath (). such as: Cookie.setpath ("/petstore").

3. Accessing the same server with the domain name using the IP address will create different cookies.

About the use of cookies

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.