Answer: 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"]%>";
alert(name);
}
Output would be Vishal
Asked In: Many Interviews |
Alert Moderator