【问题标题】:Is setting Thread.CurrentUICulture in ViewStart a good idea?在 ViewStart 中设置 Thread.CurrentUICulture 是个好主意吗?
【发布时间】:2012-03-14 12:42:24
【问题描述】:

This discussion 建议使用基本控制器并覆盖OnActionExecutingThis one 提到覆盖 ExecuteCore

我发现可以在_ViewStart.cshtml中设置。这些方法中的一种是否优于其他方法?目前还没有登录功能,但我正在考虑将文化(来自数据库)存储在会话中并在 ViewStart 中读取会话值。

【问题讨论】:

    标签: asp.net-mvc-3 internationalization


    【解决方案1】:

    最好在 Global.asax 的 Application_BeginRequest 方法中执行此操作。在 Razor 视图中设置线程文化有点奇怪。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-11-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多