MVC - 表单身份验证、IFrame cookie、动态 Cookieless 模式
我有一个 WebApplicatoon,我的一些客户希望在 IFrame 中使用它。 但是,由于不支持在 Internet Explorer 中的 IFrame 中保存 cookie,所以我的表单身份验证不支持。
我可以通过添加
轻松解决此问题,但是由于我的网站显示其当前网址(如任何网页确实如此)当它在 iframe 之外运行时,这会导致一些非常难看的 URL。
所以我的想法是。 有没有办法在不添加 P3P 标头的情况下解决 IE(和 Safari)的 IFrame cookie 问题。
如果这是不可能的,有没有办法从代码中更改 Cookieless 模式? 我正在考虑使用 IFrame 路由来启用无 cookie 模式。 类似于 http://www.mypage.com/IFrame/Account/Login。 由于此路由仅在 IFrame 中使用,因此 URL 并不重要。
有人对此有好的解决方案吗?
I have a WebApplicatoon which some of my customers would like to use within an IFrame.
However because saving cookies within IFrame's in Internet Explorer is not supported my Forms authentication doesn't.
I can easily solve this by adding
<forms loginUrl="~/Account/LogOn" timeout="2880" cookieless="UseUri" />
However since my site shows its current url (as any web page does) when it runs outside an iframe this results in some VERY ugly Urls.
So my thought is.
Is there any way to solve the IFrame cookie issue with IE (and Safari) without adding P3P headers.
If this is not possible, is there then any way to change the Cookieless mode from code ?
Iam thinking of having a IFrame Route which then enables cookieless mode.
Something like http://www.mypage.com/IFrame/Account/Login.
Since this Route is only used within IFrame's the URL doesnt matter.
Does anyone have a good solution for this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这篇文章解决了我的问题: http://www.quickstepit.net/internet -explorer-iframe-cookies-mvc3/
我只需要在 ApplicationRequest 上添加代码,无需更改 web.config 中的“forms”标签。
我希望这对你有帮助!
再见。
This post has solved my problems: http://www.quickstepit.net/internet-explorer-iframe-cookies-mvc3/
I just needed to add a code on ApplicationRequest, without change "forms" tag in web.config.
I wish that help you!
See ya.
请参阅这篇文章,了解解决问题的正确方法:
Cookie 被阻止/未保存在 Internet Explorer 的 IFRAME 中
根据响应“标签不仅仅是一堆位,它们具有现实世界的含义,并且它们的使用给了您现实世界的责任!”。标签使用不当可能会产生法律后果。
See this post for proper way of resolving the issue:
Cookie blocked/not saved in IFRAME in Internet Explorer
According to the response "The tags are not only a bunch of bits, they have real world meanings, and their use gives you real world responsibilities!". Improper use of tags may have legal consequences.