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



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ASP.NET (included with the .NET Framework) 1.0

This article was previously published under Q326943

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:

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"  
   />
				



Modification Type:MinorLast Reviewed:11/18/2005
Keywords:kbHOWTOmaster kbLocalization KB326943 kbAudDeveloper