Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use the session variable in default.aspx.vb page like this Session("dowloa")="True" . but i get in ss.js file like this var ViewOnly = '<%=Session("dowloa") %>' i put alert msg the viewonly it show like this "'<%=Session("dowloa") %>'" but no value. how we get session value in external js file

Actually we get like in alert "True"


What I have tried:

in default.aspx.vb page like this Session("dowloa")="True" . but i get in ss.js file like this var ViewOnly = '<%=Session("dowloa") %>'
Posted
Updated 26-Jun-19 21:44pm

1 solution

You need to put a variable on the actual aspx page;

<script>
var x = '<%=Session("dowloa") %>';
</script>


You can then use "x" in your external js file as long as the script where you define "x" is interpreted before your external script file uses it, so putting it above where you include the js file is a good idea.
 
Share this answer
 
v2

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