im trying call a session variable stored in c#. My code is
var sesion_values= '<%= Session["userEmail"].ToString() %>';
console.log("sesion is: ", sesion_values);
this return:
sesion is: <%= Session["userEmail"].ToString() %
From what I see the asp.net code is not run, so you probably place it inside the javascript file - where asp.net not compile it.
One trick is to add it on .aspx page (or on master page) just before you load the javascript file...
for example, inside the asp.net code do this.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
var sesion_values = '<%=Session["userEmail"].ToString()%>';
</script>
<script src="yourscript.js"></script>
</head>
then you can use the sesion_values
inside the javascript file.