Retaining a HttpWebRequest.CookieContainer?

08-11-2007, 03:42 PM
I would like to retain a HttpWebRequest.CookieContainer between connections, is there a way I can create an object just to hold it?

I've been creating two HttpWebRequest objects and then setting the CookieContainer of the second one equal to the first one but would rather work with only one HttpWebRequest if possible.

Another alternative would exist if it is possible to redirect a HttpWebRequest without using .Create (something like .Navigate for the WebBrowser). I've found several posts in forums asking how to do this but no answers as of yet.



08-11-2007, 04:32 PM
Depends on what you are trying to do. For example, what type of application and technology are you using? If you were using a Web Service, you would enable session state at the server and you could hold the cookie container at the proxy, for future requests. When you say between TWO connections, are these both authenticated requests? Are you purposely using two connections instead of one? If so, for what purpose?

Each HttpWebRequest should have a .create method, since every heavy unit of work, requires its own connection typically.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum