Page.Session Property
.NET Framework 2.0
Gets the current Session object provided by ASP.NET.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
'Declaration Public Overridable ReadOnly Property Session As HttpSessionState 'Usage Dim instance As Page Dim value As HttpSessionState value = instance.Session
/** @property */ public HttpSessionState get_Session ()
public function get Session () : HttpSessionState
Not applicable.
Property Value
The current session-state data.This property provides information about the current request's session. A Session object is maintained for each user that requests a page or document from an ASP.NET application. Variables stored in the Session object are not discarded when the user moves from page to page in the application; instead, these variables persist as long as the user is accessing pages in your application. For more information about session state, see ASP.NET Session State.
| Topic | Location |
|---|---|
| How to: Read Values from Session State | Building ASP .NET Web Applications |
| How to: Sample Session-State Store Provider | Building ASP .NET Web Applications |
| How to: Save Values in Session State | Building ASP .NET Web Applications |
| How to: Read Values from Session State | Building ASP .NET Web Applications |
| How to: Sample Session-State Store Provider | Building ASP .NET Web Applications |
| How to: Save Values in Session State | Building ASP .NET Web Applications |
The following code example creates a GetStyle function that retrieves a key stored in the session state of the Web Forms page and converts its value to a string.
' Create a private function that obtains ' information stored in session state ' in the application's Global.asax file. ' When this method is called and a key name ' that is stored in session state is passed ' as the parameter, the key is obtained and ' converted to a string. Function GetStyle(Key As String) As String Return Session(Key).ToString() End Function
Community Additions
ADD
Show: