jquery - Unable to get existing session in .net with Chrome & Firefox where as it is working IE 9 -
i unable existing session in .net web service using firefox , chrome, working in ie 9 or higher.
case: using session.isnewsession property check weather session new or existing. property gives me false if session existing using internet explorer, in firefox , chrome giving me true.
in web service don't have session variable stored in this, wanted check weather session new or existing.
i calling web service using .ajax call.
[scriptmethod(responseformat = responseformat.json), webmethod(enablesession = true)] public string getbusinesspartnerbykey(string cardcode, string dbname) { general.writelog("getting bp key : " + cardcode, "bp"); //if (general.company != null) //if (session["session"]!=null) if (!session.isnewsession) //here getting true in ie , false in firefox , chrome. { try { //do 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", ""); }
this javascript snippet
$.ajax({ type: "post", url: clienturl + "/getbusinesspartnerbykey", data: json.stringify({ cardcode: cardcode, dbname: $.session.get("dbname") }), contenttype: "application/json; charset=utf-8;", datatype: "json", error: function (xhr, status, error) { try { var msg = json.parse(xhr.responsetext); $(this).messagebox('error', msg.message); } catch (e) { $(this).messagebox('error', xhr.responsetext); } return true; }, success: function (data) { xml = $.parsexml(data.d); $bp = $(xml); $businesspartner = $bp; if ($bp.find('result').text() == '0') { //do success stuff } } else { if ($bp.find('result').text() == "-99") { //do session exipration stuff } else { $(this).messagebox('error', $bp.find('message').text()); } } } });
issue resolved, doing tweak in global.asax file.
Comments
Post a Comment