我有以下代码,我想在KeyValuepair类型的对象中存储标题的所有键和值(即cookie,会话ID等)。我怎么能做到这一点?
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;
我需要这些值,因为之后我将使用相同的cookie和sessionid发布到网站。