0

I have added Verb Attributes to method as described in previous questions The url is simply http://192.168.1.66:51457/api/Home/4031.

[Authorize]
[AcceptVerbs("PUT")]
[HttpPut]
public IHttpActionResult Put(int Username, [FromBody]Models.User Content)
{
    …

my web api route config is:

   config.MapHttpAttributeRoutes();

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

within the postman headers it returns : Allow → GET,POST Hopefully this is enough information.

I'm sending this Json:

{
  "Email": null,
  "Password": null,
  "FirstName": null,
  "LastName": null,
  "Country": null,
  "PostCode": null,
  "MaxLocation": 0,
  "DOB": "2018-09-04T00:00:00",
  "MinAge": 30,
  "MaxAge": 31,
  "Gender": true
}
General Grievance
  • 4,555
  • 31
  • 31
  • 45
Mark Evans
  • 45
  • 1
  • 1
  • 8

1 Answers1

1

Try to remove the attributes:

[AcceptVerbs("PUT")]
[HttpPut]
Christian
  • 63
  • 9