I try to log all posted data in my WebApi when a exception is thrown. I have try this:
protected async override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
if (request.Content == null)
return await base.SendAsync(request, cancellationToken);
var Body = await request.Content.ReadAsStringAsync();
request.Properties["body"] = Body;
return await base.SendAsync(request, cancellationToken);
}
And in my error log method i get the posted values in Properties["body"]Properties["body"].
But when the users upload a image iI get this when iI try to get the files: This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.
at System.Web.HttpRequest.get_Files()
This method or property is not supported after HttpRequest.GetBufferlessInputStream has been invoked.
at System.Web.HttpRequest.get_Files()
How can iI store only posted data(text)data(text) in this property?