Hi All,
I have a web site where few pages are shown inside an IFrame.. The problem is with session in IE.. How can i get session in IE IFrames... Pls help
Thanks
Hi All,
I have a web site where few pages are shown inside an IFrame.. The problem is with session in IE.. How can i get session in IE IFrames... Pls help
Thanks
anish.anick reported a classic IE/iframe symptom: the session cookie is not being sent when the page is hosted inside an iframe. As noted, many people used a P3P compact-policy header as a workaround and confirmed it worked here. That fix is a historical, browser-specific workaround rather than a general solution.
Why it happens: when the iframe is served from a different origin the cookie becomes a third‑party cookie and IE’s privacy rules can block it. Modern browsers have moved to cookie attributes such as SameSite and stricter defaults for third‑party cookies, so relying on browser hacks is brittle. See the P3P spec and the modern SameSite behavior for context: P3P (W3C) and SameSite cookie attribute (MDN).
Practical checklist to diagnose and fix (apply in order):
Set-Cookie response and the Cookie header on subsequent requests to the iframe. SameSite=None; Secure for third‑party cookies. A safer cross-origin pattern is to keep authentication at top level and pass a short-lived token to the iframe using postMessage (validate origin and use HTTPS). See the postMessage docs for a secure pattern: Window.postMessage (MDN).
Note: P3P headers will still work in some IE configurations but are nonstandard and fragile. Prefer same-domain cookies, SSO/token flows, or secure message-passing for long-term reliability.
Jump to Post— AleMonteiro 238This is a known bug, to fix add this code inside the On_Init event.
Response.AddHeader( "p3p", "CP=\"IDC DSP COR ADM DEVi TATi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" );I suggest that you put in on a master page or, as I do: I …
This is a known bug, to fix add this code inside the On_Init event.
Response.AddHeader( "p3p", "CP=\"IDC DSP COR ADM DEVi TATi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" ); I suggest that you put in on a master page or, as I do: I extend the System.Web.UI.Page and override the function:
//---------------------
// OnInit
//---------------------
protected override void OnInit ( EventArgs e )
{
// Header para resolver problema de sessão dentro de frames
Response.AddHeader( "p3p", "CP=\"IDC DSP COR ADM DEVi TATi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"" );
} Then in my page I use this class as the base.
Hope it helps!
Thank you very much. It worked perfectly.
Regards,
Chaitanya.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.