Implementation method of two-level domain name or cross-domain shared cookies _javascript tips

Source: Internet
Author: User


Note the point:
1, when you have a cookie group (or a cookie dictionary) using the domain attribute to specify the field name, when you modify or add to the members of the group, be sure to add resonse.cookies (cookiename) after the operation. Domain attribute.
2, if not necessary, please do not modify the Set domain cookie group, directly using Response.Cookies ("cookietext") = Cookievalue to create a new cookie. For each independent response.cookies ("Cookietext"), whether or not there is a dictionary, write one at a time, if you need to write more than once, for another response.cookies ("Cookietext"). This is very important.
3, Response.Cookies ("CookieName"). Secure = False,secure property must be False
Example:
Response.Cookies ("Uto") ("Utorname") =utorname
Response.Cookies ("Uto") ("Utorpwd") =utorpwd
Response.Cookies ("Uto"). Domain= "Utoper.com"
Response.Cookies ("Uto"). Secure =false
4, IE for the. CN short domain name support has a major bug, no way to write cookies, someone tested: http://blog.csdn.net/xssh913913/archive/2007/08/04/1725882.aspx solution:
such as h5.cn domain name, in h5.cn all subdomains, no matter from which child domain name receives the information, all sends to h5.cn this domain name to write the cookies, writes does not set the domain name, namely these two sentences do not.
Response.Cookies ("User"). Domain = "h5.cn"
Response.Cookies ("User"). Secure =false
This makes it normal to invoke cookies in any other subdomain.

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.