How to access Session value in JavaScript?

 Posted by vishalneeraj-24503 on 12/19/2013 | Category: JavaScript Interview questions | Views: 1694 | Points: 40

Session as we know that,is used across the application and is used for storing any values.

Suppose,Session["Name"] is defined in Page Load Event

protected void Page_Load(object sender, EventArgs e)

Session["Name"] = "Vishal";

If we want to access Session["Name"] from inside Javascript,

function access_session_value()

var name = "<%=Session["Name"]%>";

Output would be Vishal

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response