Click here to Skip to main content
15,790,957 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all,

I am using project..
Is it possible to use session value in javascript.
Pls reply

Updated 12-Feb-23 2:48am

You cannot get the session id value directly in client side as the session is generated server side.

To get the value in client side (javascript), you need a routine to pass the session id to javascript. This can be done using a hidden field runat=server" and pass the session id value to hidden field in code behind page_load method.

Hope this gives you a fair idea.

Share this answer
try this one.......
Getting session value in javascript[^]
Share this answer
we can simply get session value using java script as described below.

<script language="javascript">

var session = '<%= Session["VALUE"] %>';

Share this answer
<pre lang="Javascript">
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900