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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:04:43+00:00 2026-05-23T12:04:43+00:00

I have added a new route to my routing table: routes.MapRoute( ModuleRoute, // Route

  • 0

I have added a new route to my routing table:

  routes.MapRoute(
          "ModuleRoute", // Route name
          "Module/{href}", // URL with parameters
          new { controller = "Module", action = "GetHtml" }// Parameter defaults
      );

I need this route to match on the following url structure:

/module/123abc.html

The problem is it also matches on this structure

/module/Launch/123abc.html

Calling link :

    <%: Html.ActionLink("Launch", "Launch", new { href = item.Href })%>   

How do I stop that from happening? I want he second structure to continue to be matched by the default route. I thought that because the number of parameters are different that this would not be a problem.

How can better filter my route to prevent this?

Thanks!

  • 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-23T12:04:44+00:00Added an answer on May 23, 2026 at 12:04 pm

    i agree with Max Toro, i’ve done some testing and that URL doesn’t match Module/{href}.

    This:

    <%: Html.ActionLink("Launch", "Launch", new { href = item.Href })%>
    

    is actually hitting the default route. You see this if you change the default route to the below (note the id is changed to href

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

    so, this proves it is falling through the first route since it gets a proper url (no querystrings)

    what it is doing (when you have the usual default route with id) is that the controller and action are matched but the id isn’t. This is OK – the route still matches but leaves off the id. All additional values, such as your href are appended as querystring parameters so you end up with:

    module/Launch?href=123abc.html
    

    The way to get around it is to add another route similar to the one above that uses href instead of id

    something like:

     routes.MapRoute(
         "Launch",
         "Module/Launch/{href}",
         new { controller = "Module", action = "Launch", href = UrlParameter.Optional }
     );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Most of my content is in a new table I have added to JOOMLA
I am new to iphone development.I have created a UIview controller class and added
I have created new module called 'currency' and configured routes in module.config. It is
I am new to ruby and rails. Here in routes.rb i have added the
I have just added routing in a new asp.net 4 web forms application, and
My storyboard seems locked. I have added new labels and imageviews to two different
I have added a new job in my hudson server which builds the project
I have IIS 7.5 With one web site I added new virtual directory and
I have a list within Sharepoint, using a custom new form I have added
We recently added a new TeamCity build agent. Because it doesn't have 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.