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

속성 값

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

설명

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

적용 대상

추가 정보