So I stumbled on this problem while creating a application that get's cookies from a website. For some reason the program only outputs a few cookies instead of every single one, somebody told me it might be because some cookies are created with JavaScript. Is it possible making this still in C#,
Thanks.
- string url = textBox1.Text;
- var cookies = new CookieContainer();
- HttpWebRequest myCall = (HttpWebRequest)WebRequest.Create(url);
- myCall.CookieContainer = cookies;
- HttpWebResponse response = (HttpWebResponse)myCall.GetResponse();
- myCall.AllowAutoRedirect = true;
- myCall = (HttpWebRequest)WebRequest.Create(url);
- myCall.CookieContainer = cookies;
- foreach (Cookie cookie in response.Cookies)
- {
- Console.WriteLine(cookie.Name);
- Console.Read();
- }
- myCall.Abort();