I am making a call to Web API from my Console App. I get HttpResponseMessage
as the response. I am unable to read that message content.
I tried
var loginResult = await response.Content.ReadAsAsync<loginresult>(new List<MediaTypeFormatter> { new JsonMediaTypeFormatter() });
Visual studio complains that ReadAsAsync
doesn't exist and also MediaTypeFormatter
doesn't exist.
But it makes sense why it's not working, because It uses MediaFormatters
which are specific to MVC. ReadAsAsync
also doesn't support console apps.
How do i read HTTPResponseMessage
content in Console App ?