The Problem
Q: Why "make sure to implement P3P if using iframes" ?
A: If your application is inside iframe with parent belongs to another domain - cookies will not work for some very common configurations for example IE 6/7 with privacy set to medium. If cookies don't work - session won't work.
Therefore session state turns out useless for your application under Internet Explorer. See - Privacy in Internet Explorer 6.
This is relevant when domain that hosts iframe is different from parent domain. Because of the fact that this is not very common scenario - only a few familiar with the solution.
The Solution
Solution - need to implement P3P header to tell the browser that cookies for your application inside iframe are OK for user privacy.
So, ASP.NET implementation may look like the following (global.asax):
protected void Application_BeginRequest(Object sender, EventArgs e)
{
//
HttpContext.Current.Response.AddHeader("p3p", "CP=\"CAO PSA OUR\"");
}
本文解释了为何在使用iframe时需要实现P3P政策。在特定浏览器配置下(如IE6/7隐私设置为中等),若未实施P3P,则可能导致应用内cookie无法正常工作,进而影响会话管理。文章提供了ASP.NET环境下实现P3P的一个示例。
534

被折叠的 条评论
为什么被折叠?



