views:

637

answers:

1

I have a .NET client application that needs to communicate with a server using two distinct user credentials. Lets say that the application runs two threads. When start running, every thread sends the user & password to authenticate and the server in return stores a cookie on the http session. The subsequent calls send the authentication cookie and not the user credentials.

We have two cookies for the same process. How does wininet "knows" to send the appropriate cookie for each thread?

Does wininet manage the cookies collection per thread? per http session? per process?

Thanks

+1  A: 

Wininet uses cookies per process.

However in a .NET client you can use a Cookie container with the HttpWebRequest object.

You create one cookie container for each "session". Assign the appropriate container to each HttpWebRequest when making the various requests for each session.

AnthonyWJones
what you are saying that if my application will not perform special handling the default behavior would be to always send the last cookie recieved from the server. right?
LiorH