问题
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