1

我的网站有一些问题需要处理。问题之一是加载 5x。

我一直在尝试为页面设置特定语言。我的问题如下:

当页面刷新 n 次时,它会在某处覆盖页面语言设置。我在 Application_Start 方法中测试了修改 global.asax 页面。这个方法只被调用一次。在此页面进入 default.aspx 页面并点击页面 ntimes 后,当页面初始化时,它将文化更改为默认文化 en-GB,而不是我在 Page_Load 事件中设置的文化。

我已经设置了线程。当前的 。UI 和文化到我的特定文化。但这不起作用。

我努力了:

  1. 在 global.asax 中设置语言
  2. 在 global.asax + onload 页面中为我的 default.aspx 设置语言
  3. 使用会话设置语言,并在重新加载页面后显示在正确的页面中。

有任何想法吗?

4

1 回答 1

3

如果你将它添加到 Global.asax.cs 它应该可以工作。这个对我有用。

protected void Application_BeginRequest(object sender, EventArgs e)
{
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-ch");
    Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("de-ch");
}

但是你对这个问题的描述有点混乱......

于 2012-10-25T12:59:32.517 回答