我正在登录一个网站并尝试获取会话和cookie,我的cookie容器在我的方法之外,但是我无法获取cookie并将其发送给我的请求,我尝试使用处理程序的方式与我的cookie容器,但我收到一个错误
字段初始值设定项不能引用非静态字段c#
这就是我想要做的事情
private CookieContainer cookieContainer = new CookieContainer();
private HttpClientHandler clienthandler = new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true, cookieContainer };
private HttpClient client = new HttpClient(clienthandler);
Run Code Online (Sandbox Code Playgroud)
那么我怎样才能使用处理程序,以便我可以设置会话并发送会话?谢谢.
c# ×1