Jey*_*mov 1 globalization session cultureinfo httpcontext asp.net-mvc-3
我在mvc3应用程序中使用以下方法:
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
if (HttpContext.Current.Session != null)
{
CultureInfo ci = (CultureInfo)this.Session["Culture"];
if (ci == null)
{
string langName = "az";
ci = new CultureInfo(langName);
this.Session["Culture"] = ci;
}
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ci.Name);
}
}
Run Code Online (Sandbox Code Playgroud)
为什么这种方法被多次调用?
当站点在其他PC的新浏览器中打开时,找不到站点资源.
您的页面是否有多个元素(图像,脚本等),导致多个HTTP Get请求?如果是这样,这将为每个发射一次.
| 归档时间: |
|
| 查看次数: |
5258 次 |
| 最近记录: |