Declare :
Session[“userId”]=”1”;
Retrive:
string userId =(string)Session[“userId”];
Loading
Declare :
Session[“userId”]=”1”;
Retrive:
string userId =(string)Session[“userId”];
Session Declaration is all follow
{
Session[“UserName”]=”Vaibhav”;
}
Use declared session like
{
string Name =(string)Session[“UserName”];
}
Session is a cookie variable in server and it is handle in server level in our entire web technologies (asp.net,asp.net mvc).
System.web.HttpContext httpcontext= new System.web.HttpContext();httpcontext.Current.Requiest.Session["variable_name"]="variable_value";
I hope above is ok our understanding purpose.
Session["variable_name"]="Session value";