maintain session (cookies, etc) as you use webrequest...

T

titan nyquist

I am surfing through a website via webrequest... but the session
"dies" from one webpage load to another. It's as if I load each
webpage in a "new browser" (conceptually inside my code) where there
are not cookies or previous knowledge of the previous webpages I have
already loaded.

How do I maintain a sessions (cookies and all) using webrequest???

~titan
 
N

Nicholas Paldino [.NET/C# MVP]

Titan,

You will want to create a new instance of the CookieContainer class, and
assign it to the CookieContainer property on the HttpWebRequest that makes
the request. That CookieContainer contains the cookies from the
request/response that you will want to carry over to the next
request/response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top