DrJaul
DrJaul

Reputation: 103

FromBody parameter (as jobject and string) is always null

Ive been reading the sundry posts about "From body param is null" and none of the solutions in them have solved my problem.

I have this ajax call

$.ajax({
        url: '/User/UpdateSessionNoteBase/' + noteData['noteId'],
        contentType: "charset=utf-8",
        type: 'POST',
        data: JSON.stringify(noteData),})

and this C# function call (.Net FW)

[System.Web.Http.HttpPost]
public JsonResult UpdateSessionNoteBase([FromUri]int id, [FromBody]string data)

I have tried including contentType:"application\json" and making the datatype of the [FromBody] param a JObject, and keeping the variabe as a string, and nothing Iv tried makes that param have a value. The fromURI parameter works fine regardless.

Does anyone have any insights into this?

Upvotes: 1

Views: 88

Answers (0)

Related Questions