Assigning the ASP.NET Session Variable using Javascript:
<script type= "text/javascript" > function SetUserName() { var userName = "Jagdish Kholiya" ; '<%Session["UserName"] = "' + userName + '"; %>' ; alert( '<%=Session["UserName"] %>' ); } </script> |
Accessing ASP.NET Session variable using Javascript:
<script type= "text/javascript" > function GetUserName() { var username = '<%= Session["UserName"] %>' ; alert(username ); } </script> |