Chinaunix首页 | 论坛 | 博客
  • 博客访问: 274726
  • 博文数量: 80
  • 博客积分: 2269
  • 博客等级: 大尉
  • 技术积分: 836
  • 用 户 组: 普通用户
  • 注册时间: 2009-09-09 11:07
文章分类

全部博文(80)

文章存档

2016年(1)

2013年(8)

2012年(23)

2011年(21)

2010年(21)

2009年(6)

我的朋友

分类:

2011-04-22 11:16:59

这前认为每次xmlhttp 请求是独立的一次请求,类似于新的ie窗口请求,也就是说这些请求之间是不共享session的.
今天测试发现,在一个浏览器(ie)中,发送的xmlhttp请求,是共享session的.就好像这个浏览器的请求一样.
 
这么久才发现原来这样,不知对错.
 

function AjaxEngine(fun,para,url)
     {
     $.ajax({
                   type: "POST",
                   url: url,
                   data: para,
                   beforeSend: function(){
             //ShowLoading();

         },
         complete: function(){
             //HideLoading();

         },
                   success: function(msg){
                        if(fun!=null){
                            fun(msg);
                        }
                   },
                   error: function(){
             alert("请求服务器数据出错,请与管理员联系!");
         }
                });
     }
    
    
     function test()
     {
     AjaxEngine(aa,"","WebForm1.aspx");
     }

 

后台代码:

public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            if (Session["aa"] == null)
            {
                Response.Write("no seesion");
                Session["aa"] = "dfdsafdfa";
            }
            else
                Response.Write(Session["aa"].ToString());
        }
    }


阅读(2364) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~