Exportar (0) Imprimir
Expandir Tudo
Este artigo foi traduzido por máquina. Coloque o ponteiro do mouse sobre as frases do artigo para ver o texto original. Mais informações.
Tradução
Original

HttpContext.Session Propriedade

Gets the HttpSessionState object for the current HTTP request.

Namespace:  System.Web
Assembly:  System.Web (em System.Web. dll)

public HttpSessionState Session { get; }

Valor da propriedade

Tipo: System.Web.SessionState.HttpSessionState

The HttpSessionState for the current HTTP request.

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").

Contribuições da comunidade

ADICIONAR
Mostrar:
© 2014 Microsoft