Name
CodePage
Synopsis
Integer = Session.CodePage Session.CodePage = Integer
Returns or sets an Integer indicating the code page to be used in generating the page output. The code page is the character set that contains all characters and punctuation for a given locale setting.
Parameters
-
Integer
An Integer variable that will receive or set the code page property value.
Example
The example writes the current code page value to the Text property of the Message label control:
Sub Page_Load( ) Message.Text = "Current Code Page is: " & Session.CodePage End Sub
Notes
The CodePage property is provided for compatibility with classic ASP.
For new ASP.NET development, you should use the ContentEncoding
property of the Response
class for formatting
output to a given code page, or configure globalization settings in
web.config
(see Chapter 8 and Chapter 20 for more
information on globalization settings).
In the example above, although the property value is an Integer, ASP.NET automatically casts the Integer value to a String, which is then assigned to the Text property. This works because any .NET object or data type can be represented as a String.
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.