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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:41:32+00:00 2026-06-07T12:41:32+00:00

I have a routing problem and I can’t figure out how to solve it.

  • 0

I have a routing problem and I can’t figure out how to solve it.

There’s a controller named “UsersController” and it contains 2 Post action functions:

public int PostFBLogin(User userObject){}
public void PostUpdateImgUrl(User userObject){}

When I make a POST request, I pass a JSON representation of “User” in the request body.
If I comment out one of these functions, then it works fine.
But when the both functions exist, whenever I try to make a request to each one of them, I get the following error:

"Multiple actions were found that match the request:
Int32 PostFBLogin(MestoryServer.Models.User) on type MestoryServer.Controllers.UsersController
Void PostUpdateImgUrl(MestoryServer.Models.User) on type MestoryServer.Controllers.UsersController"

I tried to solve it by putting the following routes in the routing tables:

            RouteTable.Routes.MapHttpRoute(
                name: "UserPostUpdateImgUrlAction",
                routeTemplate: "api/users/PostUpdateImgUrl/",
                defaults: new
                {
                    controller = "users",
                    action = "PostUpdateImgUrl"
                }
            );

            RouteTable.Routes.MapHttpRoute(
                name: "UserPostFBLoginAction",
                routeTemplate: "api/users/PostFBLogin/",
                defaults: new
                {
                    controller = "users",
                    action = "PostFBLogin"
                }
            );

But it didn’t help.

After looking at lots of posts about routing tables on the internet, I’m not sure that it’s even possible to have two actions which have the same signatures but different names.

Can anyone help?

Thanks,
Edi.

  • 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-07T12:41:34+00:00Added an answer on June 7, 2026 at 12:41 pm

    When you make a HTTP request with the Web API, the HTTP method is used to identity the action to invoke. A HTTP Post request will invoke the method within the ApiController that starts with “POST”. By convention the Web API expects (at most) one method per HTTP method. This is the cause of the error you are receiving.

    The default route for Web API does not specify action:

    routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{id}",
        defaults: new { id = RouteParameter.Optional }
    );
    

    You could alter the above to include action, e.g. routeTemplate: "api/{controller}/{action}/{id}" but then you have to add [HttpPost] above the methods.

    Or you could consider splitting your Web Api controller into two. The PostFBLogin method could be moved into a LoginController and the PostUpdateImgUrl method could stay in the UsersController.

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

Sidebar

Related Questions

I have a match that render by a named parameter match '/:username' => 'controller#action'
I'm learning Yii and got into url routing problem. I have a controller as
I have a controller that can be invoked as modulename/xmlcoverage with index action and
I am new to Rails routing and I currently have a problem and hope
NOTE: I have read Routing From the Inside Out AND the Engine Yard blog
I again have problem with routing :) When I run application if user is
I have a problem with the routing while using the Searchable Plugin of Neil
So I have an interesting problem here. I am using URL Routing to mask
I'm testing Java's i18n features and have a problem, I can't load the language
I am working on a Vehicle Routing Problem. Recently I have spent a bit

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.