0

I have developed WebAPI and it is working fine but with some doubts.

I created methods for Login as POST: "http://localhost:25782/api/Account/IsValidUser" But it runs with URL "http://localhost:25782/api/Account/IsValidUser/post" Only.

Why I need to append "/post" in URL?

My code of WebAPI:

[HttpPost]
[ActionName("IsValidUser")]
public HttpResponseMessage GetValidUser([FromBody] LoginModel model)
{ ...
k-s
  • 2,192
  • 11
  • 39
  • 73
  • See: http://stackoverflow.com/questions/9552761/get-and-post-methods-with-the-same-action-name-in-the-same-controller Do you have any other methods in your controller? There must be a reason why the `post` is being appended. You could also use a `RouteAttribute`. – Dan Wilson Jan 03 '17 at 17:56
  • There are other methods but different namings. – k-s Jan 03 '17 at 17:58
  • look at this url: http://stackoverflow.com/questions/20226169/how-to-pass-json-post-data-to-web-api-method-as-object – Valeh Mikayilzadeh Jan 03 '17 at 18:03
  • Thank you for help, got it working by applying change in routing priorities in WebApiRoute file. – k-s Jan 03 '17 at 18:17

0 Answers0