开发者

Setting User language for Localization/Globalization

I need to select the language based on the user choice and set it for the entire session. Can anybody suggest 开发者_JS百科where do i need to do these settings and how can i do this?


See CultureInfo. A tutorial can be found here . Briefly: change Thread.CurrentThread.CurrentUICulture and Thread.CurrentThread.CurrentCulture


I got the solution by setting the current thread in global.asax

protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
        {           
            if (HttpContext.Current.Session != null)
            {
                if (HttpContext.Current.Session["userCultureInfo"] != null)
                {
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(Session["userCultureInfo"].ToString());

                }
            }
        }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜