Share via


IHttpSessionState.CodePage 속성

정의

현재 세션에 대한 코드 페이지 식별자를 가져오거나 설정합니다.

public:
 property int CodePage { int get(); void set(int value); };
public int CodePage { get; set; }
member this.CodePage : int with get, set
Public Property CodePage As Integer

속성 값

Int32

현재 세션에 대한 코드 페이지 식별자입니다.

예제

다음 코드 예제에서는 구현 합니다 CodePage 의 속성을 IHttpSessionState 가져오고 현재 응답의 인코딩을 설정 하는 인터페이스입니다.

//
// Session.CodePage exists only to support legacy ASP compatibility. ASP.NET developers should use
// Response.ContentEncoding instead.
//
public int CodePage
{
  get
  { 
    if (HttpContext.Current != null)
      return HttpContext.Current.Response.ContentEncoding.CodePage;
    else
      return Encoding.Default.CodePage;
  }
  set
  { 
    if (HttpContext.Current != null)
      HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding(value);
  }
}
'
    ' Session.CodePage exists only to support legacy ASP compatibility. ASP.NET developers should use
' Response.ContentEncoding instead.
'
Public Property CodePage As Integer Implements IHttpSessionState.CodePage    
  Get
    If Not HttpContext.Current Is Nothing Then
      Return HttpContext.Current.Response.ContentEncoding.CodePage
    Else
      Return Encoding.Default.CodePage
    End If
  End Get
  Set       
    If Not HttpContext.Current Is Nothing Then _
      HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding(value)
  End Set
End Property

설명

문자 집합 (코드 페이지)는 문자 값을 결정 하는 멀티 바이트 문자 데이터를 해석 하 고 정렬 순서에 사용 됩니다. 코드 페이지 설정은 멀티 바이트 문자가 아닌 데이터를 유니코드 문자 데이터에만 적용 됩니다.

CodePage 속성은 이전 버전 ASP와의 호환성을 위해 제공 됩니다. ASP 페이지를 사용 하 여 이전 버전과 호환성을 유지 해야 하는 경우 사용 하 여 합니다 CodePage 의 속성을 ContentEncoding 속성 대신 합니다.

적용 대상

추가 정보