如何WININET处理Cookie [英] How does wininet handle cookies

查看:479
本文介绍了如何WININET处理Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要使用两个不同的用户凭据的服务器进行通信的.NET客户端应用程序。
比方说,应用程序运行两个线程。当开始运行,每一个线程发送用户放大器;密码验证,作为回报,在服务器上存储HTTP会话的cookie。随后调用发送身份验证cookie,而不是用户凭据。

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.

我们有两个饼干的相同的过程。如何WININET知道送每个线程相应的cookie?

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

是否WININET管理每个线程的Cookies集合?每个HTTP会话?每个进程?

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

感谢

推荐答案

的Wininet使用每个进程的曲奇。

Wininet uses cookies per process.

然而,在.NET客户端,您可以使用一个Cookie容器与HttpWebRequest对象。

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

您为每一个会话一个cookie中的容器。分配给每个相应的容器的HttpWebRequest使每个会话的各种请求的时候。

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

这篇关于如何WININET处理Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆