HttpContext.Session Property
Assembly: System.Web (in system.web.dll)
The Session property provides programmatic access to the properties and methods of the HttpSessionState class. Because ASP.NET pages contain a default reference to the System.Web namespace (which contains the HttpContext class), you can reference the members of HttpContext on an .aspx page without the fully qualified class reference to HttpContext. For example, you can use just Session("SessionVariable1") to get or set the value of the session state variable SessionVariable1. However, if you want to use the members of HttpResponse from an ASP.NET code-behind module, you must include a reference to the System.Web namespace in the module and also fully qualify the reference to both the currently active request/response context and the class in System.Web you want to use. For example, in a code-behind page you must specify the full name HttpContext.Current.Session("SessionVariable1").
| 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: Display Safe Error Messages | 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: Display Safe Error Messages | Building ASP .NET Web Applications |
| How to: Save Values in Session State | Building ASP .NET Web Applications |
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.