我试图通过WebClient提交类似100.3的小数,但由于某种原因,只提交了100个。
private async Task addWeight(double newWeight)
{
try
{
Debug.WriteLine(newWeight);
WebClient wc = new WebClient();
wc.Encoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
wc.Credentials = new NetworkCredential("user", "pass");
var res = await wc.UploadStringTaskAsync(new Uri("http://..."), "&weightkg=" + newWeight);
}
catch (Exception)
{
Debug.WriteLine("EXCEPTION: _doSearch");
}
}
当我尝试将其小数提交到其他来源(例如curl)时,它会起作用。 编码是正确的。
有人可以在这看到问题吗?