c# - POST request in UWP not sending -


i writing app uwp

i receive json end this:

string url = "http://api.simplegames.com.ua/index.php/?wc_orders=all_orders"; {     string jsonstring;      using (var httpclient = new system.net.http.httpclient())     {         var stream = await httpclient.getstreamasync(url);         streamreader reader = new streamreader(stream);         jsonstring = reader.readtoend();     }      return jsonstring; } 

i try send post request this

orderslist = new list<rootobject>(rootobjectdata); using (httpclient httpclient = new httpclient()) {     httpclient.baseaddress = new uri(@"http://api.simplegames.com.ua");     httpclient.defaultrequestheaders.accept.add(new mediatypewithqualityheadervalue("application/json"));     httpclient.defaultrequestheaders.acceptencoding.add(new stringwithqualityheadervalue("utf-8"));      string endpoint = @"/post_from_local.php";      try     {         httpcontent content = new stringcontent(jsonconvert.serializeobject(orderslist), encoding.utf8, "application/json");         httpresponsemessage response = await httpclient.postasync(endpoint, content);          if (response.issuccessstatuscode)         {             string jsonresponse = await response.content.readasstringasync();             debug.writeline(jsonresponse);             //do json response here         }     }     catch (exception)     {         //could not connect server         //use more specific exception handling, example     } } 

but, end dev said see empty row, data not received.

thank's help. error?

change line:

var stream = await httpclient.getstreamasync(url); 

to:

var stream = httpclient.getstreamasync(url).result; 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -