I am logging in to a website and trying to get the session and cookies, my cookie container is outside my methods which works find, but I can not get cookies and send them with my requestions, I tried to use the handler the same way as my cookie container but I get an error
a field initializer cannot reference the nonstatic field c#
Here's what I was trying to do
private CookieContainer cookieContainer = new CookieContainer();
private HttpClientHandler clienthandler = new HttpClientHandler { AllowAutoRedirect = true, UseCookies = true, cookieContainer };
private HttpClient client = new HttpClient(clienthandler);
So how can I go about using the handler so I can set the session and send the session? Thank you.