no

How to Set Locale Setting in a C# Web Application Globally

To be able to set your web application global setting, you need to set it in global.asax file. And to make it more dynamic it's better t...

To be able to set your web application global setting, you need to set it in global.asax file. And to make it more dynamic it's better to set the locale setting string in web.config.

//web.config
<configuration>
  <appSettings>
  <add key="Locale" value="en-PH" />
  </appSettings>
<configuration>

//global.asax
public void Application_BeginRequest(object sender, EventArgs e)
{
  Thread.CurrentThread.CurrentCulture = new CultureInfo(ConfigurationManager.AppSettings["Locale"]);
  Thread.CurrentThread.CurrentUICulture = new CultureInfo(ConfigurationManager.AppSettings["Locale"]);
}

Related

c# 3422995315485836039

Post a Comment Default Comments

Outsourcing

Are you looking for freelancers in the Philippines? Get in touch.

Donations

If you like what I do, you can support this channel by buying me a coffee. I would be grateful for your contribution! Your donations will help me create more FREE online courses and learning materials for programmers and remote workers.

item