Answer the question
In order to leave comments, you need to log in
How to get the cookie value when making a request to the site?
Hello everyone!
You need to get the cookie value that is returned when requesting the site.
For the request I use the httpclient class.
var client = new System.Net.Http.HttpClient();
var response = await client.GetAsync("https://www.igromania.ru/");
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
var headers = response.Headers;
headers
. How do you get cookies out of there?
Answer the question
In order to leave comments, you need to log in
var setCookieHeaders = headers.Contains("Set-Cookie")
? headers.GetValues("Set-Cookie")
: Array.Empty<string>();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question