Article ID: 306162 - Last Review: October 29, 2007 - Revision: 3.5 HOW TO: Set Current Culture Programmatically in an ASP.NET ApplicationThis article was previously published under Q306162 On This PageSUMMARYThis step-by-step article describes how to change the
current culture and current UI culture in an ASP.NET application. In the .NET
Framework, the CultureInfo class from the System.Globalization namespace provides
culture-specific information such as the associated language, country/region,
calendar, and cultural conventions. The CurrentCulture property represents the
culture that the current thread uses. The CurrentUICulture property represents the current
culture that Resource Manager uses to look up culture-specific resources at
run time. There are three ways to set the Culture information in an ASP.NET
application, Application Level, Page Level, and Thread Level.
Application LevelSpecify Application Level Culture information in the Web.config file. To do this, follow these steps:
Page LevelThe Page Level Culture-specific information settings override the Application Level Culture-specific information settings. Specify Page Level Culture information by using the @Page directive. To do this, follow these steps:
Thread LevelThe Thread Level Culture-specific information settings override the Page Level Culture-specific information settings. Specify the Thread Level Culture-specific information by setting the CurrentCulture property or the CurrentUICulture property of the current thread. To do this, follow these steps:
REFERENCESFor more information, see the Microsoft .NET
Framework SDK Documentation or visit the following Microsoft Web sites: http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo(vs.71).aspx
(http://msdn2.microsoft.com/en-us/library/system.globalization.cultureinfo(vs.71).aspx)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingcurrentuicultureproperty.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconusingcurrentuicultureproperty.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconlocatingusingresourcesforparticularculture.asp
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconlocatingusingresourcesforparticularculture.asp)
| Article Translations
|
Back to the top
