0
Answer

Problem with cookies

toni gomez

toni gomez

15y
2k
1
Hello everybody!

I have a problem with the sending of cookies.

In the first HttpWebRequest I get the cookie, but when I use it for the second HttpWebRequest , the web answered me as if it would have not been sent.

This is the source code:
 
1:
CookieContainer cookieContainer = new CookieContainer();
HttpWebRequest hwrequest = (HttpWebRequest)WebRequest.Create(pUrl);
hwrequest.CookieContainer = cookieContainer;
HttpWebResponse hwresponse = (HttpWebResponse)hwrequest.GetResponse();
...

2:
HttpWebRequest hwrequest2 = (HttpWebRequest)WebRequest.Create(pUrl);
hwrequest2.CookieContainer = cookieContainer;
HttpWebResponse hwresponse2 = (HttpWebResponse)hwrequest2.GetResponse();
...
 
Thank you very much!
Toni