Assign session value using javascript

后端 未结 4 1219
一生所求
一生所求 2020-12-19 21:36

Is there any way to assign session value using javascript

i can retrive the value from session but assigning is not working

var TempSession = \'<%         


        
4条回答
  •  执笔经年
    2020-12-19 22:27

    Try using ajax call for setting the session value:-

    JS:-

    
    
    

    In your code behind file:-

    [WebMethod]
    public static string SetValue(string val)
    {
        HttpContext.Current.Session["Status"] = val;
        return HttpContext.Current.Session["Status"].ToString();
    }
    

提交回复
热议问题