I have an API (Asp.Net, written in C#) which receive a POST request on it, the request is multipart/form-data. My code to handle the request is the following:
if (request.Content.Headers.ContentType.MediaType.ToString() == "multipart/form-data")
{
var providerMulti = Request.Content.ReadAsMultipartAsync();
providerMulti.Wait();
var result = providerMulti.Result;
}
As the Wait()
is called, I receive this Exception:
Invalid 'HttpContent' instance provided. It does not have a 'multipart' content-type header with a 'boundary' parameter.\r\nParameter name: content
I don't understand.