简体   繁体   中英

How to share cookies between IE and .net 2.0 WebBrowser control?

I've got a web site that I use to sell a downloadable .net 2.0 Windows Forms application. I use Google Analytics to analyze site traffic. The .net 2.0 application has an embedded WebBrowser control. One way I use the WebBrowser, for example, is to show the customer a page on my web site where they can register their email address. Based on my experiments with IE8 on Vista, it appears that cookies are NOT shared between the WebBrowser control and IE8. One simple experiment that seems to verify this is to log on to Amazon with IE and then notice that the WebBrowser control requires you to log on again. That means that Google Analytics - which relies on cookies - can't help me identify which ads led to e-mail address acquisition inside my client. In other words, I can't use Google Analytics to analyze activity across both the web site and within the downloaded application. Based on some other posts, it appears some people have the opposite problem - cookies are shared between IE and the WebBrowser control.

Under what conditions are cookies shared between IE and the WebBrowser control? Is this behavior specific to a particular version of IE and .net? Is there a way to force sharing of cookies?

My conclusion so far is that if I really want to use Google Analytics to correlate web site traffic with activity inside my client application, then the best I can do is cause my client application to launch the full blown web browser, and NOT rely on the embedded WebBrowser control. For example, there might be a link within my program called "Get email updates" that launches IE to a specific page on my web site.

IE 7 and 8 on Vista+ run as a low integrity process by default. Your WinForms app probably runs as a medium integrity process. I don't think cookies are shared between integrity levels. What happens if you launch your app as a low integrity process?

i have the same problem, i have an app in c# with a webbrowser control but i cant access to cookies in C:\\Users\\Me\\AppData\\Roaming\\Microsoft\\Windows\\Cookies\\Low.

i try this http://support.microsoft.com/kb/2278183

and whola! i can access to the cookies, but if i click on one link to open a new browser window nothing happens :(.

I suppose it need to add your site address to trusted sites and to turn off protected mode for trusted sites. Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM