asp.net mvc - Problem switching culture -
I have 2 links to change the culture if I click on a link then program calls a method with this code Does:
threads Present. Thread Existing content Current Ukraine Agriculture = CultureInfoGetCalcherInfo (LN); Return Redirect Reactions ("Index");
If I have changed the culture properly with debug, but in index redirection, the culture GUI is not changed.
I'm trying to localize the Visual Studio Web server (Cassini).
Thank you
We do the same thing with the link on the scene though we code Do not put into action, but make a method on the base controller class. This is the verb:
public executive setculture (string syntactic) {string returnUrl = string.Empty; If (request! = Zero) {returnUrl = Request.UrlReferrer.ToString (); // Write the cookie response. Add cookies (new HTTP cookie ("language", culture code)); } If (! String.IsNullOrEmpty (returnUrl)) {come back} Redirect (return URL); } Other {Return Redirect ("List"); }}
and it is the method in the base controller class:
protected override zero ExecuteCore () {// recover from cookies HttpCookie cultureCookie = Request. Cookies ["language"]; If (Sanskritic! = Null) {string culture = cultureCookie.Value; If (String.IsNullOrEmpty (Culture)) {Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo (Culture); Thread.Centreffred.Carchant Culture = CultureInfo GatecultureInfo (culture); }} Base.ExecuteCore (); }
Comments
Post a Comment