0

I desire to use a web api filter to be able to collect the following from the request and response:

The request url, The method ( i.e. Get, POST…), both the request and response header key value pairs.

I searched stackoverflow at the following link and there is a good example of using a filter to capture the content.

Need to log asp.net webapi 2 request and response body to a database

I changed the following code from the example in the link above:

var responseBody = await result.Content.ReadAsStringAsync();

To:

var responseBody = await result.Header…; // when I picked Header methods – they would not work with await

Do Have a suggestion?

2
  • 1
    HttpHeaders does not have async methods. This answer shows how to extract header values. Commented Apr 25, 2016 at 17:21
  • You need to learn asynchronous programming to fully understand this. Commented Apr 27, 2016 at 8:18

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.