c# - MVC 6 Post action parameter is null -


i have mvc 6 application , separate mvc 6 webapi service.

i send object application using code: enter image description here

this view part of it: enter image description here

the client sends webapi service: enter image description here

where parameter null:

enter image description here

in fiddler log 0 content-length:

enter image description here

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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -