P3p solves Cross-Domain Cookie Access Problems

Source: Internet
Author: User

When I was doing a Traffic Statistics item recently, I accidentally found that IE had some security restrictions when writing cookies on pages in IFRAME, which led to the failure to read cookies, after finding a solution for a long time, find the following methods:

 

1. the cookie on the page cannot be the cookie of the browser process (including the verification ticket and the cookie without setting the timeout time), otherwise the cross-domain will not be obtained. this is rarely mentioned by people who use cross-origin cookies. however, I actually pay attention to the solutions made by several universities. I have mentioned that the cookies in their verification module set the timeout time.

2. when using IFRAME, remember to add the p3p information to the page header of the corresponding dynamic page. Otherwise, ie will consciously block the cookie in the IFRAME box, causing problems. if it is not saved, it cannot be obtained. this is actually a problem with frameset and cookie, which can be encountered by frame or IFRAME.

3. The trace output during the test reduces the test workload.

You only need to set the p3p HTTP HeaderIn the implicit IFRAME, you can set the cookie across domains. They used the following content:

P3p: Cp = 'cura ADMA Deva psao psdo our bus uni pur int DEM sta pre com nav OTC Noi DSP core'

ASP directly adds a header declaration in the header to test the validity.
<% Response. addheader "p3p", "cp = CaO PSA our" %>

PHP should be written as follows:
Header ('p3p: Cp = CaO PSA our ');

ASP. NET
InCodeAdd response. addheader ("p3p", "cp = CaO PSA our") or start ASP. NET state service in the window service.

JSP:
Response. setheader ("p3p", "cp = CaO PSA our ")

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.