I currently have a JQuery Ajax method as below;
$.ajax({
type:"POST",
url: "default.aspx/UpdateData",
data: jsonString,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg){
alert('saved');
}
});
In the ASP.NET UpdateData method I'm using;
System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
string line = sr.ReadToEnd();
I will then serialise this data using DataContractJsonSerializer.
Is using Request.InputStream the right way to read the JSON data? Can I retrieve it as a method parameter, or any other way that may be considered better?
Thanks