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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:01:41+00:00 2026-05-23T17:01:41+00:00

The current request for action ‘Index’ on controller type ‘UsersController’ is ambiguous between the

  • 0

The current request for action ‘Index’ on controller type ‘UsersController’ is ambiguous between the following action methods:
System.Web.Mvc.ActionResult PostUser(Models.SimpleUser) on type Controllers.UsersController
System.Web.Mvc.ActionResult PostUser(Int32, Models.SimpleUser) on type Controllers.UsersController

Is happening when I try to POST website.com/users/ with form values.

When there is NO ID (website.com/users/) I want it to create a new user, when there IS an ID (/users/51 for example) I want it to update that user, so how can I make it tell the difference between these two Actions?

Here are the two actions:

    [HttpPost]
    [ActionName("Index")]
    public ActionResult PostUser(SimpleUser u)
    {

        return Content("User to be created...");
    }

    [HttpPost]
    [ActionName("Index")]
    public ActionResult PostUser(int id, SimpleUser u)
    {

        return Content("User to be updated...");
    }

Here is the MapRoute:

    routes.MapRoute(
        "Users",
        "users/{id}",
        new { controller = "Users", action = "Index" }
    );
  • 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-23T17:01:42+00:00Added an answer on May 23, 2026 at 5:01 pm

    The main problem is there is some ambiguity between your two action methods, as model binding doesn’t help decern the routing configuration. Your current routing simply points to index method.

    You can still have the same URL, but it would be helpful to name your actions differently and then apply some new routes.

    [HttpPost]
    public ActionResult Create(SimpleUser u)
    {
        return Content("User to be created...");
    }
    
    [HttpPost]
    public ActionResult Edit(int id, SimpleUser u)
    {
        return Content("User to be updated...");
    }
    

    And then in your routing try

    routes.MapRoute(
        "UserEdit",
        "users/{id}",
        new { controller = "Users", action = "Edit", 
            httpMethod = new HttpMethodConstraint("POST") });
    
    routes.MapRoute(
        "UserCreate",
        "users",
        new { controller = "Users", action = "Create", 
            httpMethod = new HttpMethodConstraint("POST") });
    

    The routes will be constrained to POST events only, which means you can still add some routing for your GET methods on the same route. Such as for a list or something.

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

Sidebar

Related Questions

System.Web.HttpContext.Current.Response.Cookies[ssocookies].Domain = System.Web.HttpContext.Current.Request.ServerVariables[SERVER_NAME].ToString().ToLower(); System.Web.HttpContext.Current.Response.Cookies[ssocookies].Value = tokenID.ToString(); System.Web.HttpContext.Current.Response.Cookies[ssocookies].Path = ~/; System.Web.HttpContext.Current.Response.Cookies[ssocookies].Expires = DateTime.Now.AddDays(7); Now what
I'm debugging the HttpContext.Current.Request.Cookie values in an ASP.NET web application, and finding the only
What is the difference between HttpContext.Current.Request.IsAuthenticated and HttpContext.Current.User.Identity.IsAuthenticated? Which one would you use in
Description: An unhandled exception occurred during the execution of the current web request. Please
I need to convert string like this: $url = 'module/controller/action/param1/param1value/paramX/paramXvalue'; to url regarding current
I have the following controller action and test. I'm new to testing with Shoulda
I have a view which accepts the following model: Inherits=System.Web.Mvc.ViewPage<MVC_WordsByME.Models.JobCreationModel> This posts back to
I have currently the following routes: routes.IgnoreRoute({resource}.axd/{*pathInfo}); routes.IgnoreRoute({resource}.gif/{*pathInfo}); MvcRoute.MappUrl({controller}/{action}/{ID}) .WithDefaults(new { controller = home,
I know how to get the current controller name HttpContext.Current.Request.RequestContext.RouteData.Values[controller].ToString(); But is there any
I have this code: Dim pathString As String = HttpContext.Current.Request.MapPath(Banking.mdb) Dim odbconBanking As New

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.