Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord & Christian Wenz & Pranav Rastogi & Todd Miranda & Scott Hanselman

Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord & Christian Wenz & Pranav Rastogi & Todd Miranda & Scott Hanselman

Author:Jason N. Gaylord & Christian Wenz & Pranav Rastogi & Todd Miranda & Scott Hanselman
Language: eng
Format: epub
Publisher: John Wiley & Sons
Published: 2013-04-14T16:00:00+00:00


Making Modifications to the web.config File

Now that the Web.sitemap file is in place and ready, the next step is to provide some minor additions to the web.config file. In order for your web application to make an automatic detection of the culture of the users visiting the various pages you are providing, you must set the Culture and uiCulture settings in the @Page directive, or set these attributes for automatic detection in the <globalization> element of the web.config file.

When you are working with navigation and the Web.sitemap file, as in this example, making this change in the web.config file is actually best so that it automatically takes effect on every page in your application. Adding it to the web.config file makes it much simpler because you won’t have to make these additions yourself to every page.

To make these changes, open your web.config file and add a <globalization> element, as shown in Listing 17-32.

LISTING 17-32: Adding culture detection to the web.config file

<configuration> <system.web> <globalization culture="auto" uiCulture="auto" /> </system.web> </configuration>

For the auto-detection capabilities to occur, you simply set the culture and uiCulture attributes to auto. You also could have defined the values as auto:en-US, which means that the automatic culture detection capabilities should occur, but if the culture defined is not found in the various resource files, then use en-US (American English) as the default culture. However, because you are going to define a default Web.sitemap set of values, there really is no need for you to bring forward this construction.

Next, you create the assembly resource files that define the values used by the Web.sitemap file.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.