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

  • Home
  • SEARCH
  • 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 3877650
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:31:20+00:00 2026-05-19T22:31:20+00:00

In older asp.net – projects we used to set the language usually within the

  • 0

In older asp.net – projects we used to set the language usually within the Application_BeginRequest – Handler (Global.asax), something like this:

System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cookie.Lang)

Now I am switching to MVC 2 and decided to keep the language as a fix route within the URL. The URL looks like this: {lang}/{controller}/{action}

How and where should I read the language from the URL and set the CurrentCulture? How is it best done the MVC – way?

Thx for any tipps!

  • 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-05-19T22:31:20+00:00Added an answer on May 19, 2026 at 10:31 pm

    Something like this in global.asax should work

    protected void Application_AcquireRequestState(object sender, EventArgs e)
    {
        MvcHandler handler = Context.Handler as MvcHandler;
        if (handler == null)
            return;
    
        string lang = handler.RequestContext.RouteData.Values["lang"] as string;
    
        CultureInfo culture = CultureInfo.GetCultureInfo(lang);
    
        Thread.CurrentThread.CurrentUICulture = culture;
        Thread.CurrentThread.CurrentCulture = culture;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an older asp.net mvc solution (s#arp framework) whith two projects one for
I'm using an older version of ASP.NET AJAX due to runtime limitations, Placing a
Currently, I'm maintaining an older ASP.NET website. In the solution, there exists 5 C#
I've been developing an ASP.NET site on an older machine running XP home. I
I'm using some third-party controls that use an older version of the ASP.NET Ajax
Decided to learn ASP.NET MVC and instantly got stuck on something simple. In Web
Using ASP.NET as programming language on IIS Server. the Database is access and i
We've got an older ASP.NET app written in VS 2005. I'd like to upgrade
What steps I need to perform in order to convert asp.net 2 application from
I'm working on a basic Issue Management System in order to learn ASP.NET MVC.

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.