Click here to Skip to main content
15,917,618 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to fetch the 'Culture' and 'uiCulture' value from the web.config file to my code behind file.

The application is still taking my system culture,in some scenarios, even though I have defined the 'culture' and 'uiculture' values.

What I have tried:

I had used the below code to fetch the details.


VB
Dim configSection As System.Web.Configuration.GlobalizationSection = CType(config.GetSection("system.web/globalization"), _
System.Web.Configuration.GlobalizationSection)


But in some scenarios it is returning the System culture value.
Please help me out in resolving the same.

I am thinking of directly assigning the web.config attributes to the code behind so that it will be overridden.

Please provide me a suggestion.
Posted
Updated 30-Nov-16 0:42am

1 solution

Why do you think that fetching a culture from web.config would help at all?
You need to refer to the user (client) culture, and the "centralised" culture in which you store all information rather than accessing a "random" culture which will come back the same for all users.

Normally what happens is that the Server software requests the Client culture so it can "normalise" user input (particularly dates and numbers) to a general format for storage - which can be whatever you are comfortable with, but UTC DateTime values are recommended. It then converts that general storage format to the appropriate Client culture when it outputs data, and doesn't have to worry about the input format any more.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900