I have a custom dto class:
public class myObject
{
public string Id { get; set; }
public string Name { get; set; }
}
and a Controller using Web Api (4.5 .net framework)
[HttpPost]
public IHttpActionResult StripArchiveMailboxPermissions(myObject param)
{
DoSomething(param);
return OK();
}
The client side only has 4.0 .net framework So I won't be able to use the PostAsJsonAsync() method. what is the solution to pass the object from my client to the server?
I have tried somethinig like the following:
var response = Client.SendAsync(new HttpRequestMessage<myObject>(objectTest)).Result;
however it throws me the exception:
Could not load file or assembly 'Microsoft.Json, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
The system cannot find the file specified.
Isn't it possible to use the Newtonsoft.Json library?