.NET Running 2 instances of the WebBrowser Control (separate cookie containers)

半腔热情 提交于 2019-12-24 22:20:30

问题


I'm trying to login to my website with two different accounts (admin/regular user) to test out some permissions masks - in short its a simple admin tool. Is there any way to run 2 instances of the WebBrowser control with separate cookie containers on two separate windows without having to execute your program twice?

Edit: I'm using C#.


回答1:


Don't think it is possible short of patching WinInet API calls. The WinInet implementation of session is one per each process pre-IE8, and LCIE shared across processes in IE9 when LCIE is not disabled.

Spin-off child processes get around http-only cookies but those cookie persisted in the user's IE cache would still overwrite each other. I had to run different instances in different windows accounts via CreateProcessAsUser for one site.



来源:https://stackoverflow.com/questions/2397273/net-running-2-instances-of-the-webbrowser-control-separate-cookie-containers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!