Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
In my ASP project, created a Session Variable and assigned a Value in a asp page.
VB
<%
Session("name")="Mike"
%>

I have to get this session "name" value in the another html file (.htm) thru Jquery (Javascript). Using IE 6.0 version(Browser). Is it possible or is anyother way to solve this?. Waiting for your replies.
Posted
Updated 20-Feb-13 11:17am
v2
Comments
José Amílcar Casimiro 20-Feb-13 17:36pm    
If you want to add ajax to the problem, then yes. Check this link: http://stackoverflow.com/questions/9650930/how-to-update-session-variable-with-jquery-ajax-is-it-even-possible
José Amílcar Casimiro 20-Feb-13 17:37pm    
Get session variable with JQuery

http://forums.asp.net/t/1623703.aspx/1

1 solution

use this code may be i'll help you

function abc()
{
var testUser = '<%= Session["User"] %>';
alert(testUser);
}
 
Share this answer
 
Comments
Tharaka MTR 23-Feb-13 3:38am    
this is wrong you can't use the server side variable with .html page.
bkthebest 23-Feb-13 4:01am    
do correct yourself

i am using this code in my application and it is working perfectly
KryptoMandi 25-Apr-14 4:49am    
on an HTML page the alert outputs '<%= Session["User"] %>' on an aspx page it get gets the user

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