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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:24:42+00:00 2026-05-14T05:24:42+00:00

We have a couple ASP MVC websites just using the standard VS templates default

  • 0

We have a couple ASP MVC websites just using the standard VS templates default settings – Working as wanted. But now I want to localize these website ( They are now in Dutch and I will add the English language )
I would like to use routing and not Resource because:
1. Languages will differ in content, numbers of pages, etc.
2. The content is mostly text.

I would like the URLs to look some thing like this – http://www.domain.com/en/Home/Index, http://www.domain.nl/nl/Home/Index.
But the last one should also work with – http://www.domain.nl/Home/Index – Witch is the exciting URLs.

I have implemented Phil Haacks areas ViewEngine from this blogpost – http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx. But only putting the English website in the areas and keeping the Dutch in old structure. Witch are served as Phils default fallback.
But the problem is here that I have to duplicate my controllers for both language’s.

So I tried the work method described in this tread – ASP.NET MVC – Localization route. It works OK with the ?en? and /nl/ but not with the old URLs.

When using this code in the global.asax the URL without the culture isn’t working.

public static void RegisterRoutes(RouteCollection routes)
        {
            //routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default",                                              // Route name
                "{culture}/{controller}/{action}/{id}",                           // URL with parameters
                new { culture = "nl-NL", controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

            routes.MapRoute(
                "DefaultWitoutCulture",                                              // Route name
                "{controller}/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

        }

I properly overlooking some thing simple but I can’t get this to work for me. Or are there a better way of doing this?

  • 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-14T05:24:42+00:00Added an answer on May 14, 2026 at 5:24 am

    To make the url without culture work I would probably create my own implementation of the route class. That could look something like this:

    public class LocalizedRoute : Route
    {
        //Constuctors
    
        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            var routeData = base.GetRouteData(httpContext);
            var culture = "en";
            if (httpContext.Request.Url.ToString().Contains(".nl"))
                culture = "nl";
    
            routeData.Values.Add("culture", culture);
    
            return routeData;
        }
    }
    

    Then you can use that something like this when you register your routes:

    var route = new LocalizedRoute("{controller}/{action}/{id}", new MvcRouteHandler()) {
        Defaults = new RouteValueDictionary(new { controller = "Home", action = "Index", id = "" }),
        Constraints = new RouteValueDictionary(),
        DataTokens = new RouteValueDictionary()
    };
    
    routes.Add("DefaultWitoutCulture", route);
    

    This code could, of course, be cleaned up a bit. But this is a basic example of how I would solve your problem.

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

Sidebar

Related Questions

I have a couple of solutions, but none of them work perfectly. Platform ASP.NET
I have a couple of questions regarding VBScript and ASP Classic: What is the
I have an ASP.Net page that will be hosted on a couple different servers,
I'll have couple of python functions I must interface with from the assembly code.
I have a couple of files containing a value in each line. EDIT :
We have a couple of mirrored SQL Server databases. My first problem - the
I have a couple old services that I want to completely uninstall. How can
We have a couple of developers asking for allow_url_fopen to be enabled on our
I have a couple of header files, which boil down to: tree.h: #include element.h
I have a couple of triggers on a table that I want to keep

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.