ASP.NET Core HttpRequest class has no BinaryRead method

Viewed 581
1 Answers

You can use a MemoryStream on the Request and retrieve the content of the Body.

Something like:

using (var ms = new MemoryStream(2048))
{
    await Request.Body.CopyToAsync(ms);
    var rawData = ms.ToArray();  
}
Related