Jquery 无法使用Chrome&;获取.net中的现有会话;Firefox在何处工作IE 9

Jquery 无法使用Chrome&;获取.net中的现有会话;Firefox在何处工作IE 9,jquery,.net,google-chrome,firefox,Jquery,.net,Google Chrome,Firefox,我无法使用Firefox和Chrome在.NETWeb服务中获取现有会话,因为它在IE9或更高版本中工作 案例: 我正在使用Session.IsNewSession属性检查会话是否为新会话或现有会话。如果使用Internet Explorer存在会话,则此属性将为false,而在Firefox和Chrome中,它将为true 在我的web服务中,我没有存储任何会话变量,我只是想检查会话是新的还是现有的 我使用.ajax调用调用此web服务 [ScriptMethod(ResponseForma

我无法使用Firefox和Chrome在.NETWeb服务中获取现有会话,因为它在IE9或更高版本中工作

案例: 我正在使用Session.IsNewSession属性检查会话是否为新会话或现有会话。如果使用Internet Explorer存在会话,则此属性将为false,而在Firefox和Chrome中,它将为true

在我的web服务中,我没有存储任何会话变量,我只是想检查会话是新的还是现有的

我使用.ajax调用调用此web服务

 [ScriptMethod(ResponseFormat = ResponseFormat.Json), WebMethod(EnableSession = true)]
    public string GetBusinessPartnerByKey(string CardCode, string dbName)
    {
        General.WriteLog("Getting BP by key for : " + CardCode, "BP");
        //if (General.Company != null)
        //if (Session["Session"]!=null)
        if (!Session.IsNewSession) //here I am getting true in IE and false in Firefox and Chrome.
        {
            try
            {
               //do some stuff
             }
            catch (SqlException e1)
            {
                return code.General.Response("-1", e1.Message, "");
            }
            catch (Exception e1)
            {
                return code.General.Response("-1", e1.Message, "");
            }
        }
        else
            return code.General.Response("-99", "Session Expire", "");
    }
这是我的JavaScript代码片段

$.ajax({
类型:“POST”,
url:ClientURL+“/GetBusinessPartnerByKey”,
数据:JSON.stringify({CardCode:CardCode,dbName:$.session.get(“dbName”)}),
contentType:“应用程序/json;字符集=utf-8;”,
数据类型:“json”,
错误:函数(xhr、状态、错误){
试一试{
var msg=JSON.parse(xhr.responseText);
$(this.MessageBox('error',msg.Message));
}
捕获(e){
$(this.MessageBox('error',xhr.responseText);
}
返回true;
},
成功:功能(数据){
xml=$.parseXML(data.d);
$BP=$(xml);
$BusinessPartner=$BP;
如果($BP.find('Result').text()='0'){
//做一些成功的事情
}
}
否则{
如果($BP.find('Result').text()==“-99”){
//做一些课时活动
}
否则{
$(this.MessageBox('error',$BP.find('Message').text());
}
}
}

});通过在global.asax文件中进行一些调整,问题得以解决