Windows 8 HttpClient.PostAsync-为什么会引发ArgumentException
我有其他的表单帖子可以正常工作,但出于某种原因,这篇帖子会抛出一条“System.ArgumentException:值不在预期范围内”消息 有什么不对劲吗Windows 8 HttpClient.PostAsync-为什么会引发ArgumentException,windows-8,windows-runtime,winrt-xaml,windows-8.1,Windows 8,Windows Runtime,Winrt Xaml,Windows 8.1,我有其他的表单帖子可以正常工作,但出于某种原因,这篇帖子会抛出一条“System.ArgumentException:值不在预期范围内”消息 有什么不对劲吗 using (HttpClient client = new HttpClient()) { HttpMultipartFormDataContent data = new HttpMultipartFormDataContent(); data.Add(new HttpStringContent(about ?? Stri
using (HttpClient client = new HttpClient())
{
HttpMultipartFormDataContent data = new HttpMultipartFormDataContent();
data.Add(new HttpStringContent(about ?? String.Empty), "about");
data.Add(new HttpStringContent(displayName ?? String.Empty), "name");
data.Add(new HttpStringContent(email ?? String.Empty), "email");
data.Add(new HttpStringContent(firstName ?? String.Empty), "firstName");
data.Add(new HttpStringContent(lastName ?? String.Empty), "lastName");
data.Add(new HttpStringContent(phone ?? String.Empty), "phone");
data.Add(new HttpStringContent(isPublic.ToString()), "isPublic");
data.Add(new HttpStringContent("true"), "isPrimaryProfile");
Uri uri = new Uri(url, UriKind.Absolute);
HttpResponseMessage responseMessage = await client.PostAsync(uri, data);
}
啊,显然空字符串不是HttpStringContent的有效值