English 中文(简体)
为什么要读,CurrentCulture.Name显示,当我的服务器将区域语言定为英语时,“en-US”
原标题:Why is Thread.CurrentThread.CurrentCulture.Name showing "en-US" when my server s regional language is set to English (United Kingdom)

I have a Web Application which at various points makes users enter dates and also displays dates to users. When debugging (and when the site is running on our test and staging servers) the date formats appear in dd/mm/yyyy format (when using DateTime.ToShortDateString()). These servers (and my dev environment have "English (United Kingdom)" set as the language under the windows regional options. All good so far. However, on the live server dates appear in the format mm/dd/yyyy even though the live server still has the language set to "English (United Kindgom)". I ve seen this question which explains how to parse the date in a specific format and I already know how to get the date in the required string format (DateTime.ToString("dd/MM/yyyy")) but am wondering what other OS setting on the live server is causing this discrepancy? I ve also seen this question, but it doesn t seem to answer my question.

Some additional information: on the dev, test and staging environments System.Threading.Thread.CurrentThread.CurrentUICulture.Name="en-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name="en-GB"

And on the live environment System.Threading.Thread.CurrentThread.CurrentUICulture.Name="en-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name="en-US"

最佳回答

您是否检查了<条码>全球化部分<代码>。

You can set it declaratively like so:

    <globalization uiCulture="en-GB" culture="en-GB" />

See: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx

问题回答

区域环境在用户基础上适用,因此,你需要确保改变区域环境,而任何用户都根据,例如,根据区域环境评估申请。 网络服务。

象许多其他人一样,寻求这样做的方法(google “IIS改变区域环境”。 它期望大多数人通过将环境打入登记处的适当部分(<代码>下)来做到这一点。 HongEY_USERSIUSR-SIDControl Panel International

当然,在Begin请求活动中,你可以推翻这一点。

但是,真正的根本原因是,视窗不为英语。 我们拿到美国英语:没有资源的地方用于对基于性别的暴力,这样就能够避免对基于性别的暴力的资源进行大量不成功的调查。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签