GlobalizationSection.FileEncoding Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value specifying the default encoding for .aspx, .asmx, and .asax file parsing.
public:
property System::Text::Encoding ^ FileEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
[System.Configuration.ConfigurationProperty("fileEncoding")]
public System.Text.Encoding FileEncoding { get; set; }
[<System.Configuration.ConfigurationProperty("fileEncoding")>]
member this.FileEncoding : System.Text.Encoding with get, set
Public Property FileEncoding As Encoding
Property Value
The default encoding value.
- Attributes
Examples
The following code example demonstrates how to use the FileEncoding property. This code example is part of a larger example provided for the GlobalizationSection class.
// Display FileEncoding property.
Console.WriteLine("FileEncoding: {0}",
configSection.FileEncoding);
' Display FileEncoding property.
Console.WriteLine("FileEncoding: {0}", _
configSection.FileEncoding)
Remarks
The FileEncoding property specifies the default encoding that is used to interpret the data that is included in the .aspx, .asmx, and .asax file types. If the file encoding is specified in the Web.config file, the actual file must be saved in the same encoding. Unicode files and UTF-8 files that are saved with the byte order mark prefix IsByteOrdered property are automatically recognized regardless of the value of the FileEncoding.
If the FileEncoding property setting for the server or application is configured to use UTF-16, and if UTF-16 is not the encoding that is used for an .aspx page in the scope of the configuration file, the output that is sent to the client browser is corrupted. For this reason, ensure that the configured FileEncoding value matches the encoding that is used in the .aspx page.