asp.net - Web API session managment -


my requirements - have web api whch gives me data db. have .net website consumes api data. want when i'm login website want manage session in "api".

i know session in web api not approach still need this.

i have implemented session management in web api(taken reference here) , working fine if i'm sending request postman(i.e. i'm setting variables in session calling 1 method , retrieving session variable calling 2nd method). when i'm doing same asp.net website jquery i'm not getting stored session variable(what noticed i'm getting session id different every time-for each request).

code of saving variable in session

    $.ajax({                 url: 'http://localhost:63726/api/login/login',                 type: "get",                 datatype: "json",                 success: function (data) {                     alert("success");                 },                 error: function (data) {                     alert("error");                 }             }); 

code of retrieving variable stored in session

    $.ajax({                 url: 'http://localhost:63726/api/sessioncheck/loginname',                 type: "get",                 datatype: "json",                 success: function (data) {                     alert("success");                 },                 error: function (data) {                     alert("error");                 }             }); 

what need achieve goal..your opinion save days...

please, read web api session storage before.

to retreive data session use javascript sessionstorage (instead ajax).


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -