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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:12:31+00:00 2026-06-18T02:12:31+00:00

Currently we use the below routing rules to cater for all our controllers; the

  • 0

Currently we use the below routing rules to cater for all our controllers; the advantage being that we don’t have to define a route for each action in each controller:

routes.MapHttpRoute("3", "{controller}/{action}/{arg1}/{arg2}/{arg3}");
routes.MapHttpRoute("2", "{controller}/{action}/{arg1}/{arg2}");
routes.MapHttpRoute("1", "{controller}/{action}/{arg1}");
routes.MapHttpRoute("0", "{controller}/{action}");

However due to this the parameter names in the methods must match; like so:

// Example method signature
public ResponseDto GetResponse(int arg1, int arg2)

If the parameter names are changed to something more friendly (eg: a name that would show the intention of each parameter instead of an ambiguous “arg1” name) like so:

// Better example method signature
public ResponseDto GetResponse(int userId, int itemId)

The binding would break unless:

  • The routes and parameter names are explicitly defined
  • The arguments are passed in using a query string

Is there are way to set up WebApi routing so it will automatically use the correct action based on the number of parameters; rather than the parameter names?

  • 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-18T02:12:32+00:00Added an answer on June 18, 2026 at 2:12 am

    It seems you’re trying to do something similar to what is described in this good blog post on custom parameter binding. As you’ve found out, there is nothing out-of-the-box to support what you’re trying to do.

    At a conceptual level, HTTP is built around the concept of resources. A URI should identify a specific resource. Using generic positional “parameters” seems to blur the specificity of a resource. It seems that your use case might be better served by using the query string of the URI. That way, your HTTP API expresses a clear intent of what parameters are expected for a given resource.

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

Sidebar

Related Questions

We currently use Subversion for our release management, and tag all of our releases
We currently use an SVN hook (below) that sends email notification on every commit
I currently use the following code to position a div directly below an input
I currently use the free obfuscation tool that ships with VS and it does
Below is the part code I currently use to write to a file, Try
I currently use mechanize to read gzipped web page as below: br = mechanize.Browser()
I currently use virtual hosts on my computer so that I can manage multiple
I'm looking at revamping our malloc() in our operating system kernel. We currently use
I have a project that has a few dependencies on other Jars. I currently
We currently use the code below to download files from a network server to

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.