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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:17:48+00:00 2026-06-10T05:17:48+00:00

I found something strange with routing… I´m testing a MVC3 application in Visual Studio

  • 0

I found something strange with routing…

I´m testing a MVC3 application in Visual Studio Web Express 2012

  • I created a new MVC3 application to isolate the problem
  • I added the following route before the default route:

        routes.MapRoute(
            "default_localization",
            "{language}/{country}/{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = UrlParameter.Optional }
        );
    
  • Then without any other change (there are no areas anything just the initial files after creating the project), I ran the application and at first sight everything was working fine. Since it is a new application there are two links at the top of the page:

    • Home
    • About

The action links look like:

<li>@Html.ActionLink("Home", "Index", "Home")</li>
<li>@Html.ActionLink("About", "About", "Home")</li>

Then this is what is happening:

  • When the browser URL is: http://localhost:54870/

    • The Home link is: http://localhost:54870/
    • The About link is: http://localhost:54870/Home/About

    HTML

    <li><a href="/">Home</a></li>
    <li><a href="/Home/About">About</a></li>
    

    Which is OK

  • But after clicking the About link, the browser URL is: http://localhost:54870/Home/About

    • The Home link becomes: http://localhost:54870/Home/About
    • The about link becomes: http://localhost:54870/Home/About/Home/About

    They still execute the correct action even when the link is messed up.

    HTML

    <li><a href="/Home/About">Home</a></li>
    <li><a href="/Home/About/Home/About">About</a></li>
    

If I remove my custom routing everything works as expected

  • Why is this happening?

  • How can I fix it?

  • 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-10T05:17:49+00:00Added an answer on June 10, 2026 at 5:17 am

    I just found the problem

    Basically I read several routing articles and finally I got it, my problem was that my custom route was been picked up always after I clicked the About link

    Why?

    Let’s consider it:

    When my URL was http://localhost:54870/, my custom route was not picked up because I didn’t have default values for {language} and {country} therefore my route didn’t match

    But when my URL was http://localhost:54870/Home/About my custom route was always picked up because the route engine assumed that Home/About were the {language} and {country} segments and since I had default values for {controller} and {action} the rout simply was a match

    Well I learnt my lesson and I learnt more about routing. In the future I’m planning to follow the KISS principle when defining routes

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

Sidebar

Related Questions

I come up with something strange in my application that I found myself adding
We just found something strange with our rails 3.1.3 app's application.js. The problem is
In my Java application, I use a third-party library. However, I found something strange,
I was working on a demo method and found something strange(at least to me
I happened to something strange to me on CALayer.And finally found the CALayer's frame.size
I've been experimenting with CSS3 and found something strange. Heres's the part of DIV
I've just found something very strange in PHP. If I pass in a variable
I'm using eclipse egit with github. I found something strange that I didn't change
If statetement : I found something strange. Why does my second 'if' is equal
Something I have found strange since I started working on GWT is how few

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.