I am trying to perform a get request to https://www.footlocker.dk/. I need to obtain the session that is created, when visiting this url.
I perform the request as following:
string url = "https://www.footlocker.dk/";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Proxy = null;
request.CookieContainer = new CookieContainer();
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
foreach (Cookie cookie in response.Cookies)
{
Console.WriteLine("name=" + cookie.Name);
Console.WriteLine("value=" + cookie.Value);
Console.WriteLine("path=" + cookie.Path);
Console.WriteLine("domain=" + cookie.Discard);
}
}
However it doesnt return me any cookies..
I need these cookies, when I want to go ahead and make a post request afterward, to perform a specific action on this url.
Regards!
question from:
https://stackoverflow.com/questions/65887230/why-can-i-not-iterate-through-the-cookies-when-i-perform-a-request-to-an-url 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…