在 WebBrowser 中使用来自 CookieContainer 的 cookie
有没有什么方法可以让我实际使用 cookie 容器中的 cookie(之前从 WebRequest 获取)并在 WebBrowser 控件中使用它们?如果是这样,我该怎么做?这是针对 C# 中的 Winforms 应用程序。
Is there any way that I can actually use the cookies from a cookie container (taken from a WebRequest previously) and use them in a WebBrowser control? If so, how would I do this? This is for a Winforms application in C#.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(3)
您需要使用 InternetSetCookie。这是示例...
You need to make use of InternetSetCookie. Here is a sample...
这是一个如何实现这一点的示例:
Here's an example oh how this could be achieved:
尝试首先使用“客户端”CookedWebClient 进行第一次导航并从服务器获取所有 cookie。然后,您可以从 CookedWebClient 或其他一些来源(如 WebRequest)获取 CookedContainer,并在 WebBrowser 中使用它们,如下所示:
Try to first use "client" CookedWebClient for the first navitation and get all the cookies from server. Then you can take the CookedContainer from CookedWebClient, or some other source like WebRequest, and use them in WebBrowser as shown below: