cookiecontainer

Using CookieContainer with WebClient class

孤者浪人 提交于 2019-11-25 21:59:39
问题 I\'ve previously used a CookieContainer with HttpWebRequest and HttpWebResponse sessions, but now, I want to use it with a WebClient. As far as I understand, there is no built-in method like there is for HttpWebRequests ( request.CookieContainer ). How can I collect cookies from a WebClient in a CookieContainer? I googled for this and found the following sample: public class CookieAwareWebClient : WebClient { private readonly CookieContainer m_container = new CookieContainer(); protected