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

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

regards
s.vinodkumar
Posted
Updated 12-Feb-23 1: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.

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

JavaScript
<script language="javascript">

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


</script>
 
Share this answer
 
v2
NAVEEN
HTML
<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