IHttpSessionState.CodePage Vlastnost

Definice

Získá nebo nastaví identifikátor kódové stránky pro aktuální relaci.

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

Hodnota vlastnosti

Int32

Identifikátor kódové stránky pro aktuální relaci.

Příklady

Následující příklad kódu implementuje CodePage vlastnost IHttpSessionState rozhraní pro získání a nastavení kódování pro aktuální odpověď.

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

Poznámky

Znaková sada (znaková stránka) slouží k interpretaci vícebajtů znakových dat, určení hodnoty znaku a pořadí řazení. Nastavení stránky kódu se vztahuje pouze na data více bajtů, nikoli na data znaků Unicode.

Tato CodePage vlastnost je poskytována kvůli kompatibilitě s dřívějšími verzemi asp pouze. Pokud nepotřebujete udržovat zpětnou kompatibilitu se stránkami ASP, použijte CodePage místo toho vlastnost ContentEncoding vlastnosti.

Platí pro

Viz také