I use the new HttpClient to handle my web surfing project needs; However, although it is correctly installed, HttpClient does not save cookies in the Cookie container, and it is always EMPTY.
Code
private CookieContainer _cookieContainer = new CookieContainer(); private HttpClient HttpClient { get; set; } private HttpClientHandler HttpClientHandler { get; set; } public Initialize() { HttpClientHandler = new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true, CookieContainer = _cookieContainer }; HttpClient = new HttpClient(HttpClientHandler); } public CookieContainer Cookies { get { return _cookieContainer; } set { _cookieContainer = value; } } public void TEST() {
source share