Re: How to Change the Language

  •  08-09-2009, 10:39 AM

    Re: How to Change the Language

    Mikael,
     
    You can hook the asp.net application event for that :
     
    (example ,put this method into the global.asax)
     
    protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
    {
     if(Context.Request.RawUrl.ToLower().IndexOf("/cutechat/")==-1)return;
     if(Context.Session==null)return;
     object val=Context.Session["_lastCulture"];
     if(val==null)return;
     System.Globalization.CultureInfo culture=System.Globalization.CultureInfo.CreateSpecificCulture(val.ToString());
     System.Threading.Thread.CurrentThread.CurrentCulture=culture;
     System.Threading.Thread.CurrentThread.CurrentUICulture=culture;
     //throw(new Exception(val.ToString()));
    }
     
    Set the value in another page :
     
    private void ButtonCulture_Click(object sender, System.EventArgs e)
    {
       Session["_lastCulture"]=DDLCultures.SelectedValue;
    }
     
    This example need turn on Session state.
     
    Regards,
    Terry
View Complete Thread