Asp.net mvc 如何覆盖某些默认的CurrentCulture值

Asp.net mvc 如何覆盖某些默认的CurrentCulture值,asp.net-mvc,cultureinfo,Asp.net Mvc,Cultureinfo,我需要覆盖当前(或指定)CurrentCulture对象的默认日名称 我尝试了几种方法来实现这一点: 1) 在Global.asax级别: protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(XX

我需要覆盖当前(或指定)CurrentCulture对象的默认日名称

我尝试了几种方法来实现这一点:

1) 在Global.asax级别:

protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) {
    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(XXX);
    string[] newNames = { YYY };
    System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
}
2) 在控制器级别:

public HomeController() {
    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(XXX);
    string[] newNames = { YYY };
    System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
}
已正确应用指定的“CurrentCulture”对象(根据指定的XXX区域性名称)。我可以通过
@DateTime.Now.ToString(“ddd”)
表达式查看特定于区域性的日期名称。
但是,指定的“DayNames”对象似乎被忽略(但是,我可以看到“CurrentCulture”和“DayNames”属性在调试器中都被正确应用)。

有必要替代默认缩写的DayNames:

protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) {
    System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(...);
    System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.AbbreviatedDayNames = ...;
}

@DateTime.Now.ToString("ddd")