本文介绍了域的InitializeCulture更改语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有语言组合的MasterPage,问题是我想在用户启动应用程序时分配一种默认语言,之后用户可以在两种语言之间进行切换.我了解的是我必须在所有页面上覆盖InitializeCulture方法,问题是,我可以在其中保存所选语言?当我使用Cache ["Culture"]时,启动应用程序的所有用户都共享相同的Cache,并覆盖所有已登录用户的值.

I have a MasterPage with a combo with languages, the thing is that I would like to assign a default language the moment a user starts the application, after that the user can change between languages. What I understand is that I have to override InitializeCulture method on all of the pages, the problem is, where I can save the selected language? When I use Cache["Culture"] all of the user that starts the application shares the same Cache and overrides the value for all the users logged in.

我该怎么做?还是没有登录时如何保存单个用户线程的数据?

How can I do that? or how can I save data for a single user's thread when it's not logged in?

在此先感谢您的帮助.

推荐答案

使用Session对象获取特定于会话的数据,如果您需要将选择保留在会话之外,则需要将其与任何用户数据一起存储

use the Session object for data specific to sessions, if you need to persist the choice beyond the session you will need to store it with whatever user data you have

Session["Culture"] = yourculturevar;

这篇关于域的InitializeCulture更改语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:50