Search This Blog

Saturday, March 6, 2010

keep your session with HttpWebRequest

after i manage to do "login" programmatically via HttpWebRequest class i wanted to consume another page that is visible only after you authenticate (e.g you have a valid session) , i found this post C# Spider with HttpWebRequest.
look at the next line , in my case its was the key, to continue with the same session that i already created - i just use the same CookieContainer i created in the first call.
CookieContainer myContainer = new CookieContainer();

enjoy
Yaniv T

No comments: