Set cookie for all requests

May 23, 2012 at 3:38 PM

Hi -

Yes, you can do this but you'll need to create a custom WebLoadRequest.

1) Derive from WebLoadRequest

2) Override CreateWebRequest and follow these instructions:

Something like this:

 protected override HttpWebRequest CreateWebRequest() {
var hwr = base.CreateWebRequest();
hwr.CookieContainer = new CookieContainer();
hwr.CookieContainer.Add(new Uri(""),
    	new Cookie("id", "1234"));

            return hwr;

3) In your GetLoadRequest, just instantiate your derived class instead of WebLoadRequest.