I have some simple code here is my Put handler .
My problem is value is blank or my second write line doesn't work in either method. How come I am not accessing the post or puts body right?
// PUT api/activate/5
public void Put(int id, [FromBody]string value)
{
System.Diagnostics.Debug.WriteLine("Put !");
System.Diagnostics.Debug.WriteLine(value);
}
heres my Post Handler code
public void Post([FromBody]String value)
{
System.Diagnostics.Debug.WriteLine("Post !");
System.Diagnostics.Debug.WriteLine(value);
}
heres the error i get
iisexpress.exe Information: 0 : Message='Action returned 'null'', Operation=ReflectedHttpActionDescriptor.ExecuteAsync iisexpress.exe Information: 0 : Operation=ApiControllerActionInvoker.InvokeActionAsync, Status=204 (NoContent) iisexpress.exe Information: 0 : Operation=ActivateController.ExecuteAsync, Status=204 (NoContent) iisexpress.exe Information: 0 : Response, Status=204 (NoContent), Method=PUT, Url=http://localhost:53676/api/activate/3, Message='Content-type='none', content-length=unknown' iisexpress.exe Information: 0 : Operation=ActivateController.Dispose The program '[14136] iisexpress.exe' has exited with code 0 (0x0).
this is how I am sending the put or post using postman
I get a 204 when sending it but that seems ok because I am not returning anything.
**What I am trying to do is access value from my asp.net code. Ie the writeline for value wont print anything because I cant get the value from the body correctly.
In a rails I would say response.body to access this server side. How do I access the data I posted in my asp.net code??**