Page.Session 속성

정의

ASP.NET 제공하는 현재 Session 개체를 가져옵니다.

public:
 virtual property System::Web::SessionState::HttpSessionState ^ Session { System::Web::SessionState::HttpSessionState ^ get(); };
[System.ComponentModel.Browsable(false)]
public virtual System.Web.SessionState.HttpSessionState Session { get; }
[<System.ComponentModel.Browsable(false)>]
member this.Session : System.Web.SessionState.HttpSessionState
Public Overridable ReadOnly Property Session As HttpSessionState

속성 값

현재 세션 상태 데이터입니다.

특성

예외

세션 정보가 .로 설정되면 발생합니다 null.

예제

다음 코드 예제에서는 Web Forms 페이지의 세션 상태에 저장된 키를 검색하고 해당 값을 문자열로 변환하는 함수를 만듭니다 GetStyle .

// 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 paramter, the key is obtained and
// converted to a string.
String GetStyle(String key) {
  return Session[key].ToString();       
}
' 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

설명

이 속성은 현재 요청의 세션에 대한 정보를 제공합니다. ASP.NET 애플리케이션에서 페이지 또는 문서를 요청하는 각 사용자에 대해 Session 개체가 유지 관리됩니다. 개체에 Session 저장된 변수는 사용자가 애플리케이션의 페이지에서 페이지로 이동할 때 삭제되지 않습니다. 대신 사용자가 애플리케이션의 페이지에 액세스하는 한 이러한 변수는 유지됩니다. 세션 상태에 대한 자세한 내용은 ASP.NET 세션 상태 개요 참조하세요.

적용 대상

추가 정보