Search This Blog

Thursday, December 27, 2012

HttpContext.Session ASP.NET

ASP.NET > HttpContext > Session

Gets the HttpSessionState object for the current HTTP request.

ASP.NET pages contain a default reference to the System.Web namespace 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("USER").

Note: 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 and also fully qualify the reference.

For example, in a code-behind page you must specify the full name:
 
HttpContext.Current.Session("USER").