<script type="text/javascript"> function SetUserName() { var userName = "Shekhar Shete"; '<%Session["UserName"] = "' + userName + '"; %>'; alert('<%=Session["UserName"] %>'); } </script>