toni gomez

toni gomez

  • NA
  • 1
  • 0

Problem with cookies

Apr 3 2009 6:02 AM
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