我从 HTTP 调用中获得了 Multipart MIME 响应,需要提取这些部分。我正在寻找一种简单的方法来做到这一点。
我正在使用 System.Net.Http 方法来获取内容,但是提取响应部分让我感到困惑。
HttpClient zClient = new HttpClient();
Uri zAddress = new Uri("http://someDomain.com");
HttpContent content = new StringContent(sb.ToString());
HttpResponseMessage response = zClient.PostAsync(zAddress, content).Result;
if (response.IsSuccessStatusCode)
{
// This returns true
bool zIsMime = response.Content.IsMimeMultipartContent();
// How do I get the message parts here. This ReadAsMultipartAsync method is confusing me.
ReadAsMultipartAsync(HttpContent) ????
}
else
{
Console.WriteLine("{0} ({1})", (int)response.StatusCode, response.ReasonPhrase);
}