c# - MVC 6 Post action parameter is null -
i have mvc 6 application , separate mvc 6 webapi service.
i send object application using code:
the client sends webapi service:
where parameter null:
in fiddler log 0 content-length:
what else should set?
it important set encoding , media type of stringcontent. if use postasjsonasync
take care of part - unfortunately can't use in dnx.
so proper code of client:
string content = newtonsoft.json.jsonconvert.serializeobject(blog); httpresponsemessage response = await client.postasync("api/values", new stringcontent(content, encoding.utf8,"application/json"));
Comments
Post a Comment