I have the following code and I want to store all keys and values of the header (i.e. cookie, session id, etc) in KeyValuepair type of an object. How can I accomplish that?
CookieContainer cookies = new CookieContainer();
HttpClientHandler handler = new HttpClientHandler();
handler.CookieContainer = cookies;
HttpClient client = new HttpClient(handler);
HttpResponseMessage response = client.GetAsync("http://google.com").Result;
HttpHeaders headers = response.Headers;
I need those values because afterwards I will use the same cookies and sessionid to post to the website.