使用jQuery + JSONP,Internet Explorer不是节约了ASP.NET会话ID [英] using jquery + jsonp, Internet explorer isn't saving the ASP.NET sessionID
问题描述
所以我使用Jquery做一些很简单的东西JSONP
So I am doing some fairly simple JSONP stuff using Jquery.
一般结构
- 网站住在域中的 A
- 的Javascript住在域中的乙
- JSON服务也住在域的乙
- Site lives on domain A
- Javascript lives on domain B
- JSON services also live on domain B
该网站称这JSONP召唤出一个JSON服务(.NET),在.net中我设置会话和返回的方法。
The site calls a method which jsonp calls out to a json service (.net) , in .net i set the session and return.
这一切工作正常,但在IE中它没有储存或传递会话ID在随后的请求。所以.NET创建一个新的每次。
This all works fine, except in IE it is not storing or passing the session id in subsequent requests.. So .net creates a new one every time.
如果我直接去了JSON的URL,即开心地保存它,并且将使用它在后续调用。
If i go to the JSON url directly, ie happily stores it, and will use it on subsequent calls.
Firefox和Chrome不具备任何与此问题,但由于某种原因,IE似乎忽略了通过jQuery的会话cookie,但响应工作正常除此之外。
Firefox and chrome don't have any problem with this, but for some reason IE seems to be ignoring the session cookie through jquery, but the response works fine besides that.
推荐答案
一个许多浏览器都更为严格的比Firefox的同源策略。这不是一个IE浏览器的问题。该XHR / MSXML对象不接受该cookie。
A lot of browsers are more restrictive with their same origin policy than firefox. It is not an IE issue. The XHR / MSXML object is not accepting the cookie.
的http:// code。 google.com/p/browsersec/wiki/Part2#Same-origin_policy
这篇关于使用jQuery + JSONP,Internet Explorer不是节约了ASP.NET会话ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!