使用共享对象
2009-05-10 12:21
197 查看
在iframe 嵌入跨域网站时,session丢失问题其根源也是由于iframe跨站点cookie被阻导致session失效。如果两个站点都是相同的父域名就没有这个问题。
问题原因:
IE6/IE7支持的P3P(Platform for Privacy Preferences Project (P3P) specification)协议默认阻止第三方无隐私安全声明的cookie,Firefox目前还不支持P3P安全特性,firefox中自然也不存在此问题了。Mircosoft对此的具体描述可以参见 Privacy in Internet Explorer 6
解决方法:
A、Rails
B、IIS
1.打开IIS管理器 inetmgr
2.选择被嵌入iframe源站点或者目录,右键点击打开属性框
3.切换到HTTP头
4.添加
5.自定义HTTP头名: P3P
6.自定义HTTP头值: CP=”CAO PSA OUR”
7.关闭属性框退出,即刻生效
至于上面CAO PSA OUR的具体意思,请参考文章:Privacy in Internet Explorer 6
问题原因:
IE6/IE7支持的P3P(Platform for Privacy Preferences Project (P3P) specification)协议默认阻止第三方无隐私安全声明的cookie,Firefox目前还不支持P3P安全特性,firefox中自然也不存在此问题了。Mircosoft对此的具体描述可以参见 Privacy in Internet Explorer 6
解决方法:
A、Rails
before_filter :send_header def send_header response.headers['P3P'] = 'CP="CAO PSA OUR"' end
B、IIS
1.打开IIS管理器 inetmgr
2.选择被嵌入iframe源站点或者目录,右键点击打开属性框
3.切换到HTTP头
4.添加
5.自定义HTTP头名: P3P
6.自定义HTTP头值: CP=”CAO PSA OUR”
7.关闭属性框退出,即刻生效
至于上面CAO PSA OUR的具体意思,请参考文章:Privacy in Internet Explorer 6
Rails and IFrames - Issues with Internet Explorer sessions While using our new Share-It iframe for a project we came across a strange session issue with internet explorer that was tough to track down a solution to. Basically we were loading an iframe with some parameters that were saved in a session, this worked fine on all browsers except for internet explorer. Every request had a new session id, so the issue had to be with the cookies. As it turns out using an iframe from a different domain name is considered "third-party" and IE blocks the cookies unless.... You set this ( P3P compact policy ) response header. P3P: CP="CAO PSA OUR"more details about the header and what it means can be found here. you can easily do this in a controller using this call in a before filter with this line: response.headers['P3P'] = 'CP="CAO PSA OUR" Since the issue was harder to find a solution to than it should have been we decided it would make a good first development post from the Sympact team. Expect More...
相关文章推荐
- FMS3系列(六):使用远程共享对象(SharedObject)实现多人时时在线聊天(Flex | Flash)
- 使用 引用计数 来跟踪访问共享对象的对象数量
- 刷新共享对象管理器缓存时发生意外错误。System.InvalidOperationException:超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并
- FMS3系列(六):使用远程共享对象(SharedObject)实现多人时时在线聊天(Flex | Flash)
- Servlet共享对象pageContext如何使用
- 一个openlaszlo使用flash的共享对象实现保存客户端信息的例子
- FMS3系列(六):使用远程共享对象(SharedObject)实现多人时时在线聊天(Flex | Flash)
- 使用临界区CRITICAL_SECTION结构对象保护多线程互斥地访问共享资源
- 使用一些需要共享对象的一点小经验
- Python multiprocessing 使用手记[2] – 跨进程对象共享
- QTP的那些事--共享对象库的使用
- LINUX使用共享对象
- 在Flex中使用本地共享对象
- Linux 创建共享对象,共享库并安装使用共享库
- 在 Linux 中使用共享对象
- FMS3系列(六):使用远程共享对象(SharedObject)实现多人时时在线聊天(Flex | Flash)
- 如何使用动态共享对象的模式来安装PHP
- 如何使用动态共享对象的模式来安装PHP
- 使用单独的命令处理类来处理命令消息(适用于有很多命令处理函数的对象,以及共享命令处理函数)
- SharedObject使用:在FluorineFx.net与Flex中使用共享对象维护在线用户列表实例【转】