Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Culture for ASP.NET MVC application on VS dev server and IIS

This is more specific and cleaner version of this question - Different DateTimeFormat for dev and test environment

In the Application_BeginRequest() method of global.asax.cs in my ASP.NET MVC project there is code:

Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); 

When I set a breakpoint on Controller Action I see the following value of Thread.CurrentThread.CurrentCulture:

  1. In VS dev server - "en-GB"
  2. In IIS - "en-US"

Question is - What settings in IIS are responsible for this and how can I override it?

like image 933
dygo Avatar asked Aug 27 '11 17:08

dygo


People also ask

What is the difference between the ASP.NET MVC application and ASP Net web application?

ASP.NET is a web platform. It provides a layer that sits on top of IIS (the web server) which facilitates the creation of web applications and web services. ASP.NET MVC is a framework specifically for building web applications. It sits ontop of ASP.NET and uses APIs provided by ASP.NET.

What are the 3 main components of an ASP.NET MVC application?

The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications.


1 Answers

Rather than setting the Thread's culture, you can specify it in the web.config like so:

<configuration>     <system.web>         <globalization uiCulture="en-GB" culture="en-GB" />     </system.web> </configuration> 

That is a more "proper" way of specifying the culture in ASP.NET.

like image 148
vcsjones Avatar answered Oct 07 '22 16:10

vcsjones