使用jquery + jsonp,Internet Explorer不会保存ASP.NET sessionID [英] using jquery + jsonp, Internet explorer isn't saving the ASP.NET sessionID

查看:85
本文介绍了使用jquery + jsonp,Internet Explorer不会保存ASP.NET sessionID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我正在使用Jquery做一些相当简单的JSONP东西.

So I am doing some fairly simple JSONP stuff using Jquery.

一般结构

  • 站点生活在域 A
  • Javascript位于域 B
  • JSON服务也位于域 B
  • 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网址,即愉快地存储它,并将在以后的调用中使用它.

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 sessionID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆