Session Declaration is all follow{Session[“UserName”]=”Vaibhav”;}
Use declared session like{string Name =(string)Session[“UserName”];}
Declare :Session[“userId”]=”1”;Retrive:string userId =(string)Session[“userId”];
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";
System.web.HttpContext httpcontext= new System.web.HttpContext();
httpcontext.Current.Requiest.Session["variable_name"]="variable_value";
Session["variable_name"]="Session value";