IHttpSessionState.CodePage Propriedade
Definição
Obtém ou define o identificador de página de código para a sessão atual.Gets or sets the code-page identifier for the current session.
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
Valor da propriedade
O identificador da página de código para a sessão atual.The code-page identifier for the current session.
Exemplos
O exemplo de código a seguir implementa a CodePage propriedade da IHttpSessionState interface para obter e definir a codificação para a resposta atual.The following code example implements the CodePage property of the IHttpSessionState interface to get and set the encoding for the current response.
//
// 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
Comentários
Um conjunto de caracteres (página de código) é usado para interpretar dados de caracteres de vários bytes, determinar o valor do caractere e, portanto, a ordem de classificação.A character set (code page) is used to interpret multi-byte character data, determining character value, and therefore sort order. As configurações de página de código aplicam-se somente a dados de caracteres de vários bytes, e não a dados de caracteres Unicode.Code-page settings apply only to multi-byte character data, not to Unicode character data.
Essa CodePage propriedade é fornecida para compatibilidade somente com versões anteriores do ASP.This CodePage property is provided for compatibility with earlier versions of ASP only. Se você não precisar manter a compatibilidade com versões anteriores em páginas ASP, use a CodePage propriedade da ContentEncoding propriedade.If you do not need to maintain backward compatibility with ASP pages, use the CodePage property of the ContentEncoding property instead.