ie9重定向后失去cookie [英] ie9 loses cookies after redirect
问题描述
我有一个iframe:
I have an iframe that:
- 向服务器发出过请求
- 302并设置Cookie
- 浏览器不保存Cookie,但发布信息(不知道为什么不获取,但不重要)
- #3失去了
- does a post request to server
- server returns 302 and sets cookie
- browser not saves cookies but does a post(don't know why not get but it doesn't matter)
- cookie from #3 are lost
我找到了一个解决方法:
i've found a workaround:
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Cache-Control", "no-cache");
但它没有帮助。
mb任何人都知道什么可以解决这个问题?
but it didn't help. mb anybody knows what can fix this issue?
推荐答案
POST而不是GET,因为这意味着有一个重要的信息,你遗漏了。没有浏览器会使用POST 跟踪HTTP / 302重定向。
You may want to look into why your browser is doing a POST rather than a GET, since that implies that there's an important piece of information that you left out. No browser will follow a HTTP/302 redirect with a POST.
In IE9, redirection responses are cached if headers allow (IE8 and below would not cache redirects).
您可以在302重定向上绝对设置一个cookie,而且重定向响应会被高速缓存,如果允许的话(IE8和以下不会缓存重定向)。这里有两种可能性:
You can absolutely set a cookie on a 302 redirect. There are two possibilities here:
- 您的Cookie被删除,因为您未能在响应中提供P3P标题,表明您的隐私权做法
- 您的重定向响应是从用户的缓存中提取的,而不是服务器,缓存的响应未设置Cookie。
鉴于您在IFRAME中遇到此问题,#1似乎更有可能。 (请参阅快速浏览P3P )
Given that you're having this problem in an IFRAME, #1 seems more likely. (See Quick Look at P3P)
这篇关于ie9重定向后失去cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!