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 www.jb51.net/test/test.aspx, then domain defaults to www.jb51.net. Cross-domain access, If domain A is t1.test.com, domain B is t2.test.com, then producing a cookie in domain A that can be accessed by domain A and domain B will set that cookie's domain to. test.com; 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 t2.test.com. 2.path indicates the directory where the cookie resides, asp.net 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 asp.net to get the & as a split character.
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.