I use asp.net and c# 4. I have a Web.Config file
<globalization culture="auto:fr" uiCulture="fr"/>
I want to get this value in a new variable programmatically in Code Behind.
var test = .......
How to get value for culture?
Solution Thanks to your Answers:
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
GlobalizationSection section = (GlobalizationSection)config.GetSection("system.web/globalization");
OpenWebConfiguration("/"); // Point to Physical path for the Web.Config file (Useful when using Routing).
GetSection("system.web/globalization"); // Get the globalization section within the system.web node.
It's a GlobalizationSection
, so you can get at it via
var globalizationSection =
WebConfigurationManager.GetSection("globalization") as GlobalizationSection;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With