Help and Support

Article ID: 326943 - Last Review: May 18, 2007 - Revision: 3.7

HOW TO: Set Culture Information in an ASP.NET Application Without Code

This article was previously published under Q326943

On This Page

Expand all | Collapse all

SUMMARY

This article describes how to set the culture for an ASP.NET application, both at the page level and at the Web application level. By default, ASP.NET supports the cultures that are listed at the following Microsoft Developer Network (MSDN) Web site:
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)

Set the Culture at the Page Level

To set the culture at page level, add the culture attribute to the page directive. For example, the Page directive for a default page that is created in Visual Studio .NET may be:
<%@ Page language="c#" Codebehind="test.aspx.cs" AutoEventWireup="false" Inherits="myweb.test" %>
				
By default, this page uses the culture that is specified by the Web server. To change the culture for this page, add the culture attribute. For example, to change this page culture to Arabic - Yemen, change the page directive to read:
<%@ Page language="c#" Culture="ar-YE" Codebehind="test.aspx.cs" AutoEventWireup="false" Inherits="myweb.test" %>
				

Set the Culture at the Web Application Level

To set the culture at the Web application level, modify or add the <globalization> tag in the <system.web> section of the Web.config file. By default, Visual Studio .NET creates a Web.config file, and it contains the following <globalization> section.
<globalization 
            requestEncoding="utf-8" 
            responseEncoding="utf-8" 
   />
				
To change the culture, add the culture attribute, and then specify the culture name. For example, to change the culture to Arabic - Yemen, change the <globalization> tag to read:
<globalization 
            requestEncoding="utf-8" 
            responseEncoding="utf-8" 
	     culture="ar-YE"  
   />
				


REFERENCES

For more information about globalization in ASP .NET, visit the following MSDN Web sites:

http://msdn2.microsoft.com/en-us/library/ydy4x04a(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/ydy4x04a(vs.71).aspx)

http://msdn2.microsoft.com/en-us/library/hy4kkhe0(vs.71).aspx (http://msdn2.microsoft.com/en-us/library/hy4kkhe0(vs.71).aspx)

APPLIES TO
  • Microsoft ASP.NET 1.1
  • Microsoft ASP.NET 1.0
Keywords: 
kbhowtomaster kblocalization KB326943

Article Translations