IHttpSessionState.CodePage Özellik

Tanım

Geçerli oturum için kod sayfası tanımlayıcısını alır veya ayarlar.

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

Özellik Değeri

Int32

Geçerli oturum için kod sayfası tanımlayıcısı.

Örnekler

Aşağıdaki kod örneği, geçerli yanıt için kodlamayı almak ve ayarlamak için arabiriminin özelliğini IHttpSessionState uygularCodePage.

//
// 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

Açıklamalar

Çok baytlı karakter verilerini yorumlamak, karakter değerini belirlemek ve dolayısıyla sıralama düzenini belirlemek için bir karakter kümesi (kod sayfası) kullanılır. Kod sayfası ayarları yalnızca çok baytlı karakter verilerine uygulanır, Unicode karakter verilerine uygulanmaz.

Bu CodePage özellik yalnızca ASP'nin önceki sürümleriyle uyumluluk için sağlanır. ASP sayfalarıyla geriye dönük uyumluluğu korumanız gerekmiyorsa, bunun yerine özelliğini ContentEncoding kullanınCodePage.

Şunlara uygulanır

Ayrıca bkz.