i have a route:
routes.MapRoute (name: "apicontroller2",
url: "api/{controller}/{action}/",
defaults: new { controller = "Default2", action = "Index" }
);
and the Default2Controller with two post methods:
[HttpPost]
public HttpResponseMessage Post(ttReview review)
{
...
}
[HttpPost]
public HttpResponseMessage PostPro(ttbewertungenpro pro)
{
...
}
when i call these API-Methods via webserver/api/default2/PostPro/ or webserver/api/default2/Post/ ajax post i get the error:
ExceptionMessage=Multiple actions were found that match the request:
System.Net.Http.HttpResponseMessage Post(WT.Models.ttReview) on type WT.Controllers.Default2Controller
System.Net.Http.HttpResponseMessage PostPro(WT.Models.ttbewertungenpro) on type WT.Controllers.Default2Controller
My ajax calls are:
$.ajax({
url: "../api/default2/Post", // or "../api/default2/PostPro",
type: 'POST',
dataType: "text",
data: review, // or pro
success: function (test) {
},
error: function (test) {
alert("Error");
}
}
is my route wrong or what? when i delete one method the other works...
PostProtoTestto get rid of the common prefixPost?