
406
|
Chapter 19: The HttpSessionState Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Sub Page_Load( )
'Example code will go here
End Sub
</script>
</head>
<body>
<asp:label id="Message" runat="server"/>
</body>
</html>
Properties Reference
CodePage
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.
Parameter
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 globaliza-
tion settings in web.config (see Chapters 8 and 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 repre- ...