Monday, January 12, 2009

ASP.NET C# Using Session variables in a class files .cs app_code

ASP.NET C# Using Session variables in a class files .cs app_code


Use HttpContext.Current.Session

VB.NET


HttpContext.Current.Session("Value1") = "1"

C#

HttpContext.Current.Session["Value1"] = "1";

HttpSession session = HttpContext.Current.Session;

session["key"] = "test";

HttpSession doesn't exist , i think we must use HttpSessionState

System.Web.SessionState.HttpSessionState session = HttpContext.Current.Session;

session["key"] = "test";


More on Session :: http://www.syncfusion.com/faq/aspnet/web_c9c.aspx#q179q

No comments: