this ticket.
2.7 p3pIf you have checked information on the Internet, you can set cookies for different domains by adding the p3p header to the response header. The setting method is as follows:
Step 1:First, set it in the hosts file (192.168.73.1 is the IP address of your local machine, which cannot be written as 127.0.0.1 .) For example, this is not required on a real server.192.168.73.1 www.a.com192.168.73.1 www. B .com
Step 2: Compile the file B _setcookie.jsp
[Java]View plaincopy
Res
that it is clearer and easier to remember.Cache header FieldRole: The exact time and date of the message generationExample: Date:sat, 11:35:14 GMTExpiresRole: The browser will use the local cache for the specified expiration periodFor example: Expires:tue, 2022 11:35:14 GMTExample: vary:accept-encodingCookie/login header FieldRole: Used to set cookies across domains, which resolves the issue of cross-domain access to cookies for IFRAMEExample: P3p:cp=cura
cache is updated. Use the local cache before it expires. The HTTP1.1 client and cache consider the illegal date format (including 0) as expired. For example, in order for the browser not to cache pages, we can also set the Expires Entity header field to 0. For example: Expires:tue, 2022 11:35:14 gmtp3p: Used to set cookies across domains, which resolves an iframe cross-domain access cookie problem For example: P3p:cp=cura ADMa DEVa Psao psdo Our BUS
host Request header field is included, as follows:host:http://www.guet.edu.cnThe default port number 80 is used here, and if a port number is specified, it becomes: Host: Specify port numberHTTP Response HeaderAlso use Fiddler to view Response header, click Inspectors tab->response tab-> headers as shownWe also classify the header according to Fiddler, so that it is clearer and easier to remember. Cache header FieldDateRole: The exact time and date of the message generationExample: Date:sat, 1
follows:host:http://www.guet.edu.cnThe default port number 80 is used here, and if a port number is specified, it becomes: Host: Specify port numberHTTP Response HeaderAlso use Fiddler to view Response header, click Inspectors tab->response tab-> headers as shownWe also classify the header according to Fiddler, so that it is clearer and easier to remember. Cache header FieldDateRole: The exact time and date of the message generationExample: Date:sat, 11:35:14 GMTExpiresRole: The browser will u
point landing application [such as the basic information of BBS Supersite]. Then loop through JS to invoke the uc.php under the API under different applications.
Next move to the uc.php call Synlogin in each application ($get, $post)
Header (' p3p:cp= "cura ADMa DEVa Psao psdo We bus UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"];
Setcookie () to enable the cookie to be set across the domain
P3P function:
For example, there are 2 applications
In frameset, where the frame is from a third party site (different IP or different domain name), then by default IE will automatically disable the cookies of these sites, that is, when a URL is requested in the HTTP header does not send their cookies, Includes a cookie for the session. Note that the cookies that these sites set in the response are still sent to the browser.
When the user browses the a.php, the A.com writes to the first party cookie, and its embedded iframe points to b.php. At t
Let's say a nested b
Workaround:The first is simple:Set System B as a trusted site.The second type:IE Set Privacy policy: In the Internet option-> Privacy-> Advanced, the "Replace automatic cookie Processing" option, and "First party Cookies" and "Third-party cookies" are set to accept the following figure:The third type:increase the P3P protocol on the head of the response;Java: Add a filter, in the Dofilter section:Java code
The code is as follows
Copy Code
HttpSe
For example, to visit station B to set up a cookie at station A, you can do this:
1. Establishment of a document under the B.Com cookies.htm
Content is:
Copy Code code as follows:
The contents of the setcookies.asp under 2.a.com are:
Copy Code code as follows:
Response.AddHeader "P3P", "Cp=cura ADMa DEVa Psao psdo our bus UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Response.Cookies ("AAA"). Domain = Request ("pa
does not pass normally in actual development.
The scenario for reproducing the problem is:
1. Visit a site first: http://192.168.18.2/test.jsp
The test.jsp code is:
Copy Code code as follows:
SSO. JSP read the Ssoinfo in the pass, call the ISMP authentication interface in reverse,
Generates a session and then puts the specified property value in the
Session. setattribute ("Ssouser", "Lizongbo");
Page Redirect to http://192.168.18.3/iframe.jsp
Response.sendredirect ("
different browsers, for example, when Safari disables a Third-party cookie, the submit from form is only post to submit the cookie.
If you can still send a Cross-domain request cookie when you want to disable a third-party cookie in your browser, you will need to use the P3P response header in a Cross-domain server to advance the cookie that is allowed to be sent.
Copy Code code as follows:
// php Header (' P3P: cp= "Cura
") Insert_new_salary = (" INSERT into salaries (emp_no, from_date, to_date, salary) "" VALUES (%s,%s,% S,%s) ") # Select the employees getting a raisecura.execute (query, (date (1, 1), date (+, +))) # Iterate through The result of Curafor (EMp_no, salary, From_date, to_date) in CurA: # Update The old and insert the new salary new_salary = Int (Round (Salary * D Ecimal (' 1.15 ')) Curb.execute (Update_old_salary, (Tomorrow, Emp_no, from
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.