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 5973909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:52:02+00:00 2026-05-22T20:52:02+00:00

I have got following routing, which basically enables me to keep the language within

  • 0

I have got following routing, which basically enables me to keep the language within the url and makes sure only de and fr (constraint) is possible. In the Default – Routing, I set de as standard if there is no language in the url contained:

// Routing with language
routes.MapRoute("Default_with_language", "{lang}/{controller}/{action}/{id}", new
{
    controller = "Home",
    action = "Index",
    id = UrlParameter.Optional,
}, new { lang = "de|fr" });
// Standard-Routing
routes.MapRoute("Default", "{controller}/{action}/{id}", new
{
    controller = "Home",
    action = "Index",
    id = UrlParameter.Optional,
    lang = "de",
});

How can I change the default-language in each request? Let’s say I have two Urls, one in german and one in french, I would like to have lang = "fr" if the french url is called…

Thx for any tipp
sl3dg3

  • 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-22T20:52:03+00:00Added an answer on May 22, 2026 at 8:52 pm

    In your Application_BeginRequest handler, you can access the current route and you should be able to change the values using something like this.

     HttpContext.Current.Request.RequestContext.RouteData.Values.Add("lang", detectedLanguageFromUrl);
    

    Hopefully, that’s enough to make routing pick up the new value.

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

Sidebar

Related Questions

I have got the following problem since the server has safe mode turned on,
I have got the following code from here to read an Excel file using
I have got the following class structure, and have plenty of classes like C
I have got the following very simple code: function init() { var articleTabs =
I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User
I have some text area field in my grails application. I got the following
If I have two domain names: altcognito.com and say I've got the other following
I have the following problem: I got a view with two text fields and
I have the following code and got myself confused: I have a query that
I have the 2 following LINQ queries and I haven't quite got my head

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.