Export (0) Print
Expand All
Expand Minimize
19 out of 31 rated this helpful - Rate this topic

<globalization> Element

Configures the globalization settings of an application.

<configuration>
   <system.web>
      <globalization>

<globalization requestEncoding="any valid encoding string"
               responseEncoding="any valid encoding string"
               fileEncoding="any valid encoding string"
               culture="any valid culture string"
               uiCulture="any valid culture string"/>

Optional Attributes

Attribute Description
requestEncoding Specifies the assumed encoding of each incoming request, including posted data and the query string. If the request comes with a request header containing an Accept-Charset attribute, it overrides the requestEncoding in configuration. The default encoding is UTF-8, specified in the <globalization> tag included in the Machine.config file created when the .NET Framework is installed. If request encoding is not specified in a Machine.config or Web.config file, encoding defaults to the computer's Regional Options locale setting. In single-server applications, requestEncoding and responseEncoding should be the same. For the less common case (multiple-server applications where the default server encodings are different), you can vary the request and response encoding using local Web.config files.
responseEncoding Specifies the content encoding of responses. The default encoding is UTF-8, specified in the <globalization> tag included in the Machine.config file created when the .NET Framework is installed. If response encoding is not specified in a Machine.config or Web.config file, encoding defaults to the computer's Regional Options locale setting. In single-server applications, requestEncoding and responseEncoding should be the same. For the less common case (multiple-server applications where the default server encodings are different), you can vary the request and response encoding using local Web.config files.
fileEncoding Specifies the default encoding for .aspx, .asmx, and .asax file parsing. Unicode and UTF-8 files saved with the byte order mark prefix will be automatically recognized regardless of the value of fileEncoding.
culture Specifies the default culture for processing incoming Web requests. For valid culture strings, see System.Globalization.CultureInfo Class.
uiCulture Specifies the default culture for processing locale-dependent resource searches. For valid culture strings, see System.Globalization.CultureInfo Class.

Remarks

If the server or application fileEncoding attribute setting is configured to use UTF-16 and UTF-16 is not the encoding used for an .aspx page in the scope of the configuration file, the output sent to the client browser will be corrupted and might possibly display the source code of the page. Please ensure that the configured fileEncoding value matches the encoding being used in the page.

Example

The following example specifies the default request and response encoding for an ASP.NET application.

<configuration>
   <system.web>
      <globalization 
         requestEncoding="iso-8859-1"
         responseEncoding="iso-8859-1"/>
   </system.web>
</configuration>

Requirements

Contained Within: <system.web>

Web Platform: IIS 5.0, IIS 5.1, IIS 6.0

Configuration File: Machine.config, Web.config

Configuration Section Handler: System.Web.Configuration.GlobalizationConfigHandler

See Also

ASP.NET Configuration | ASP.NET Settings Schema | Encoding Base Types

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.