13.3. Server-Side versus Client-Side Localization

So far, the culture has been defined completely on the server side and has not been changed for any reason (most important being changing the culture based upon what the end user's culture is set to). This next section looks at how to set culture on the server side and bring localization down to the client as well.

13.3.1. Server-Side Culture Declarations

ASP.NET enables you to define the culture used by your entire ASP.NET application or by a specific page within your application. You can specify the culture for any of your ASP.NET applications by means of the appropriate configuration files. In the default install of ASP.NET, no culture is specified as is evident when you look at the global web.config.comments file (meant for documentation purposes) found in the ASP.NET 2.0 CONFIG folder (C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG). Remember that ASP.NET 3.5 is built on top of ASP.NET 2.0 and uses the same configuration files. In the web.config.comments file, you find a <globalization> section of the configuration document. This section is presented in Listing 13-3.

Example 13-3. The <globalization> section in the web.config.comments file
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding=""
 culture="" uiCulture="" enableClientBasedCulture="false"
 responseHeaderEncoding="utf-8" resourceProviderFactoryType=""
 enableBestFitResponseEncoding="false" />

Note the two attributes represented in bold ...

Get Professional ASP.NET 3.5 AJAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.