2

I'm using How to clear System.Windows.Forms.WebBrowser session data? and it works as long as there is only one browser. Is it possible to give 2 web browser controls within the same application their own session?

If so, would I just need to change

InternetSetOption(IntPtr.Zero, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);

to

InternetSetOption(webBrowser1.Handle, INTERNET_OPTION_END_BROWSER_SESSION, IntPtr.Zero, 0);

?

Or is something else required?

Community
  • 1
  • 1
Dan
  • 25
  • 1
  • 4
  • It is not the webBrowser1.Handle, that's a window handle. It needs the session handle. I'm surprised that NULL works, but you cannot get the session handle out of the browser. – Hans Passant Sep 08 '10 at 19:22
  • Just to make sure I understand, what I'm trying to do isn't possible? – Dan Sep 08 '10 at 19:25

1 Answers1

0

Have you tried it yet? I don't think it's possible because the session is stored per browser instance. Maybe you need to clear the data from the session that belongs to that control, then you can keep session data of the other control.

MrFox
  • 4,852
  • 7
  • 45
  • 81
  • Sorry I should have added that to the comments. Yes, I tried it and it returned false though I noticed that the .Handle gives the handle of the window, not the control. How would I do what you said? – Dan Sep 08 '10 at 19:20
  • When using the session I always use the code name to store it in session. So Session["count"] = count; Will store current count. But I don't know what your store looks like, you seem to be using cookies, never used that :P. – MrFox Sep 12 '10 at 20:38