Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

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


View products that this article applies to.

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


↑ Back to the top


References

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

↑ Back to the top


Keywords: KB326943, kblocalization, kbhowtomaster

↑ Back to the top

Article Info
Article ID : 326943
Revision : 10
Created on : 5/18/2007
Published on : 5/18/2007
Exists online : False
Views : 307