try { string ip="192.165.0.6";//in fact,it is read from database HttpClient httpClient = new HttpClient() { BaseAddress = new Uri("http://"+ip+"/User") }; var checkParams = new Dictionary<string, string>() { { "UserName","Lyly"}, { "Password", "123456"} }; var validResponse = httpClient.PostAsync("http://"+ip+"/User/CheckUserValid", new FormUrlEncodedContent(checkParams)).Result; if (validResponse.StatusCode == HttpStatusCode.OK && validResponse.Content.ReadAsStringAsync().Result.Contains("ValidSuccess")) { var PointData= new Dictionary<string, string>() { { "Math","86"}, { "English", "90"}, }; var getResultResponse = httpClient.PostAsync("http://"+ip+"/User/SendPointData", new FormUrlEncodedContent(PointData)).Result; if (getResultResponse.StatusCode == HttpStatusCode.OK) { if (getResultResponse.Content.ReadAsStreamAsync().Result != null) { var reader = new StreamReader(getResultResponse.Content.ReadAsStreamAsync().Result); var lastResutl= JsonHelper.FromJson<LastRest>(reader.ReadToEnd()); } else return "Status1"; } else return "Status2"; } else return "Status3"; } catch(Exception e){ return e.StackTrace; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)