|
Session objects can be set in any BaseClasses methods, events or custom functions. Similarly Session objects
can be accessed anywhere in your application. In some cases, you may be able to access the .NET Session class
directly. If you cannot access the Session class directly, you may need to specify its full path as follows:
In C#, to access a session value:
System.Web.HttpContext.Current.Session[“MyVariable”]
(string) System.Web.HttpContext.Current.Session[“MyVariable”]
|
In C#, to set a session value:
|
System.Web.HttpContext.Current.Session[“MyVariable”] = “NewValue”
|
In Visual Basic .NET, to access a session value:
System.Web.HttpContext.Current.Session(“MyVariable”)
System.Web.HttpContext.Current.Session(“MyVariable”).ToString()
|
In Visual Basic .NET, to set a session value:
|
System.Web.HttpContext.Current.Session(“MyVariable”) = “NewValue”
|
|