The following are the parameters of the upload, sample json, the return value of the
The following is the code I wrote, always return error, trouble great god explain specifically how to modify the
The string url=@ "HTTP: * * * * * *";
String jsonParam="[{" devicecode \ ": " D3673836A72E162F00 \ ", \ "storagetime " : \ "a ", \ "indate " : \ "the 2019-05-23 10:00:00 \}"] ".
//url +=(url. IndexOf ('? ') & lt; 0? '? ':' & amp; ') + jsonParam;
Var request=(HttpWebRequest) WebRequest. Create (url);
request.Method="POST";
request.ContentType="application/json; charset=UTF-8";
Request. The KeepAlive=false;
Request. The Timeout=6000000;
//request. ContentType="application/x - WWW - form - urlencoded";
Byte [] byteData=https://bbs.csdn.net/topics/Encoding.UTF8.GetBytes (jsonParam);
Var length=byteData. Length;
Request. ContentLength=length;
Var writer.=the request GetRequestStream ();
Writer. Write (byteData, 0, length);
Writer. The Close ();
Var response=(HttpWebResponse) request. The method GetResponse ();
Var responseString=new StreamReader (response. GetResponseStream (), Encoding, GetEncoding (" utf-8 ")). ReadToEnd ();
MessageBox. Show (responseString. ToString ());
CodePudding user response:
Support a move to BBS to request for the first time, trouble youCodePudding user response:
Would it be wrong character?\ "indate " : \ "the 2019-05-23 10:00:00 "
\ "in s date \ ", \ "the 2019-05-23 10:00:00 "
CodePudding user response:
Said is likely to be # 2