언어

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

속성 값

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

예제

다음 코드 예제에서는 현재 응답에 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.

적용 대상

참고 항목