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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:35:08+00:00 2026-05-29T15:35:08+00:00

I am trying to add support for different languages to existing MVC 3 application.

  • 0

I am trying to add support for different languages to existing MVC 3 application. So far my links were

oldUrl -> myapp.com/Item/Details/5/some-title

And there are links to the website from different places on the web. But now I want to change the URL so the language is included:

newUrl -> kmyapp.com/en/Item/Details/5/some-title

However I want the oldUrl links to be valid. And the question is how do I do this… The easiest way would be to add another route, but I already have too many of them and it is getting kind of ugly, and when I create urls from a page that doesn’t have the language the links also don’t have the language so I have to do something else then.

Another way would be to override something that stands just before MVC tries to map the request to a specific route, but has already parsed the request url and filled the routeValues dictionary. So I can just check for the language and if it is not included in the route parameters I can add it on my own and call the implementation of the parent class to continue. Is that possible? What should I look at – UrlRoutingModule, MvcHttpHandler or something else? What can I override and how to tell MVC to use my version?

Any other ideas would be also appreciated!

  • 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-29T15:35:09+00:00Added an answer on May 29, 2026 at 3:35 pm

    Another way would be to override something that stands just before MVC tries to map the request to a specific route, but has already parsed the request url and filled the routeValues dictionary. So I can just check for the language and if it is not included in the route parameters I can add it on my own and call the implementation of the parent class to continue. Is that possible?

    Yes It is possible.

    You can Override GetRouteData in RouteBase which will have URL details in it.

    public override RouteData GetRouteData(HttpContextBase httpContext)
    {
            string url = httpContext.Request.AppRelativeCurrentExecutionFilePath;
    }
    

    and in global.aspx add below code.

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
        routes.Add(new MyUrlRoute()); // Add before your default Routes
    
        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
        );
    

    For more detailed implementation – refer blog
    url-manipulation-implementing-routebase.html

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

Sidebar

Related Questions

I'm trying to add globalization support to my C# application. According to MSDN, there
I'm trying to add multi-language support to an OpenSocial application. I see that I
I'm trying to add a support.v4.app.Fragment to a PreferenceActivity header, like so: <header android:fragment=com.example.SupportFragmentSubClass
I need to add IPv6 support to an existing socket-based application which currently only
I'm trying to add support for stackoverflow feeds in my rss reader but SelectNodes
I'm trying to add Jumplist support to my app, but I can only find
I'm trying to add international support for a website based on the Erlang Web
I'm trying to add generic service support to our IoC container, and I have
I'm trying to use gettext add localisation support to my website. I've followed various
I'm trying to add some keyboard support for a website I'm working on and

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.