Get Current Session Value in JavaScript?

后端 未结 11 1586
深忆病人
深忆病人 2021-02-05 01:10

I have a scenario where I open my web application in a browser but in two separate tabs.

In one tab I signed out from the application and as a result the all session val

11条回答
  •  情深已故
    2021-02-05 01:39

    Another approach is in your chtml

    
    

      and the script is

    var sessionValue= $("#hdnSession").data('value');
    

    or you may access directly by

     jQuery(document).ready(function ($) {
            var value = '@Request.RequestContext.HttpContext.Session["someKey"]';
        }); 
    

提交回复
热议问题