IHttpSessionState.CodePage Proprietà

Definizione

Ottiene o imposta l'identificatore della tabella codici per la sessione corrente.

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

Valore della proprietà

Int32

L'identificatore della tabella codici per la sessione corrente.

Esempio

Nell'esempio di codice seguente viene implementata la CodePage proprietà dell'interfaccia IHttpSessionState per ottenere e impostare la codifica per la risposta corrente.

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

Commenti

Un set di caratteri (tabella codici) viene usato per interpretare i dati di caratteri a più byte, determinare il valore del carattere e quindi ordinare. Le impostazioni della tabella codici si applicano solo ai dati di caratteri a più byte, non ai dati di tipo carattere Unicode.

Questa CodePage proprietà viene fornita per la compatibilità solo con le versioni precedenti di ASP. Se non è necessario mantenere la compatibilità con le pagine ASP, utilizzare invece la CodePage proprietà della ContentEncoding proprietà .

Si applica a

Vedi anche