我在下面中用session来保存登陆状态  [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]    public string check(string username, string pwd)
    {
        string result = _hotel.check_name(username.ToLower(), pwd);
        switch (result)
        {
            case "nNoExistName": return "it is not exist";
            case "nErrorPwd": return "pwd is error";
            case "ok": Session["login"] = username.ToLower(); return "ok";
            default: return "";
        }
    }但是我点击登陆以后 跳转到另一个页面,session中的值就丢失了, 我设了断点, 在上面的程序中Session["login"] 是获取到数值的,为什么一跳转就没有了 
这是我session的设置:    <sessionState mode="StateServer" stateNetworkTimeout="10" stateConnectionString="tcpip=127.0.0.1:42424"/>后来我把session换成默认的设置就没问题,可以登陆
以前没用ajax,上面办法是可以的 用session默认方式进程太不稳定了 谁能告诉我我那种办法有什么问题吗

解决方案 »

  1.   


    [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.Read)]
    ==》[Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]
      

  2.   

    建议用COOKIE,我也不知道是不是能够用SESSION
      

  3.   

    用1楼的方法。在ajaxpro的方法里要用session 得Ajax.HttpSessionStateRequirement.ReadWrite
      

  4.   

    跳转页面中是否有清空session 的代码
      

  5.   

    Session本来就是一个很容易丢失的东西,能不用就别用他,他丢失数据没什么奇怪的