POST が成功した後の応答に設定されている Cookie を取得しようとしています。結果からクッキーを取得するにはどうすればよいですか?
var baseAddress = new Uri("http://rtchatserver");
var cookieContainer = new CookieContainer();
using (var postHandler = new HttpClientHandler() { CookieContainer = cookieContainer })
using (var client = new HttpClient(postHandler) {BaseAddress = baseAddress})
{
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("UserName", "bar"),
new KeyValuePair<string, string>("Password", "bazinga"),
new KeyValuePair<string, string>("__RequestVerificationToken", token),
new KeyValuePair<string, string>("returnUrl", "http://google.com"),
});
cookieContainer.Add(baseAddress, responseCookies.FirstOrDefault());
var result = client.PostAsync("/account/login", content).Result;
result.EnsureSuccessStatusCode();
}