You may use Static Properties
public class TestClass
{
public static int PropertyA {
set{ HttpContext.Current.Session["objA"] = value;}
get{
return(HttpContext.Current.Session["objA"]==null
?0:int.parse(HttpContext.Current.Session["objA"].ToString())
);
}
}
}
You Can get and set easily in session using this Property.
as In
TestClass.PropertyA=10;
It will save value in Session which can be retrieved using same property
i-e
Response.Write(TestClass.PropertyA.ToString());