c#httpclient可以方便的进行http请求,而且是异步的。贼溜
var values = new Dictionary<string, string> { {"uid","uva_"+this.id.ToString() }, { "x_pos",x}, { "y_pos",y} }; var content = new FormUrlEncodedContent(values); try { HttpClient client = new HttpClient(); var response = await client.PostAsync(Global.POSTION_POST_URL, content); var responseString = await response.Content.ReadAsStringAsync(); Trace.WriteLine(responseString.ToString()); } catch (Exception e) { Trace.WriteLine(e.StackTrace); Trace.WriteLine(e.Message); //throw; }