Path and domain attributes in cookies

Source: Internet
Author: User
Tags in domain to domain

This article is mainly to the cookie in the path and domain attributes in a detailed analysis of the introduction, the need for friends can come to the reference, I hope to help you

1.domain is the domain where the cookie is located, default to the requested address, such as, then domain defaults to Cross-domain access, If domain A is, domain B is, then producing a cookie in domain A that can be accessed by domain A and domain B will set that cookie's domain to.; If you want to produce a cookie in domain A that does not have access to domain A and that domain B can access, the    The domain of the cookie is set to 2.path indicates the directory where the cookie resides, defaults to/, which is the root directory. On the same server there are directories as follows:/test/,/test/cd/,/test/dd/, now set a cookie1 path for/test/,cookie2 path for/test/cd/, All pages under test will be accessible to cookie1, while/test/and/test/dd/subpages cannot access cookie2.   This is because the cookie allows the page to be accessed under its path path.   3. The browser keeps the same cookie in both domain and path in one file, and the cookie is separated by *. 4. A cookie with a value-key value pair: It used to be a nam=value single-key-value pair cookie, one that says it's a pair of values that contain multiple subkeys. Now it's finally clear. The cookie format that contains multiple subkey value pairs is name=key1=value1&key2=value2. You can understand that the value of a single key pair holds a custom, multiple-key value string, where the key value is the delimiter, and, of course, you can customize a separator, but use the to get the & as a split character.

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: 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.