1

I'm getting a Multipart MIME response from an HTTP call and need to extract the parts. I'm looking for a simple way to do this.

I'm using the System.Net.Http methods to get the content, however extracting the response parts is confusing me.

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);
}

1 Answer 1

1
MultipartMemoryStreamProvider zMIME = await response.Content.ReadAsMultipartAsync();

Was the simple step I was looking for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.