Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7911357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:12:59+00:00 2026-06-03T13:12:59+00:00

I am trying to develop a MVC3 (razor) application with Select language functionality. Using

  • 0

I am trying to develop a MVC3 (razor) application with Select language functionality.

Using the following view as a Partial view on _Layout.cshtml
_SelectCulture

<text>
   @Html.ActionLink("English", "SetCulture", new { controller = "Culture", culture = "en-GB" })  
   | 
   @Html.ActionLink("Welsh", "SetCulture", new { controller = "Culture", culture = "cy-GB" })
</text>
<div>
    @System.Threading.Thread.CurrentThread.CurrentUICulture.ToString()
</div>

CultureController

public ActionResult SetCulture(string culture)
        {
        System.Globalization.CultureInfo ci = new     System.Globalization.CultureInfo(culture);

            System.Threading.Thread.CurrentThread.CurrentCulture = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

            return RedirectToAction("Index", "Home");
        }

But its Still not changing the Language.

Any help please.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:13:02+00:00Added an answer on June 3, 2026 at 1:13 pm

    Well, you are changing the language of the current thread. The current thread ends with the current request which is a little bit later after your controller action executes. Then you are redirecting to some other controller action. Then ASP.NET spawns a new thread to serve this request which obviously doesn’t have the culture set.

    So you will have to persist this change somewhere. Basically there are 3 different approaches:

    1. route variable
    2. cookies
    3. session

    I am putting them in the order of preference. The first approach consists into integrating a {culture} token in all your routes. IMHO this is the best approach in terms of SEO as well. So you will redirect for example to /fr/home/index if you want to get your site in French. You could then use a custom action filter attribute which will run before each action, inspect the culture route parameter and set the current thread culture (this time for the current action).

    Cookies and sessions also involve persisting the current language between the requests. In the first example this is done on the client whereas in the second it is done in the server. Once again a custom action filter could be used to read the value of the language before each action and reflect the current thread culture.

    You may take a look at the following guide which uses Session to persist the current language.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to develop a small Questionbank application using MVC3 razor and EF4.
I'm trying to develop an application in MVC 3 using EF codefirst. When I
Im trying to develop an application that should show a map using the Google
i am trying a develop a application..following is a snippet class metro_nodes { public
I'm trying to develop a WCF service in the following manner: A class library
I am trying to develop an application which has a button, which on clicking
trying to develop web form using jquery. all i need is to have several
I am trying to develop a multi-screen app for the Google TV platform using
I am trying to develop a Qt App using 4.7.3 which involves the writing
Trying to develop using MVVM: I have this Csla.PropertyStatus control that is created in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.