1

I'm developing a .NET 2.0 WinForms application. It previously included the standard Microsoft ActiveX WebBrowser control, but I'm investigating alternatives.

What I need to do:

  • Use the WebBrowser as a standard web browser control in the application

  • Be able to use it in the background too- e.g., create the control, render the webpage and output the result to an image (using .DrawToBitmap), without the control ever being attached to a form.

  • Hook into various events in the lifecycle- mainly DocumentCompleted.

  • Webpages can be loaded (or reloaded) every 30 seconds or so, either through a new instance of the control or using the existing control. The application can remain running for long and indefinite periods of time.

  • Must work with .NET 2.0. No 3.0+ or WPF stuff.

The only three controls I've been able to find so far all have rather critical issues that prevent me from going forward:

  • Microsoft ActiveX WebBrowser - Has a huge memory leak that makes it unsuitable for running for long periods of time.

  • WebKit.NET - As far as I've been able to establish this has to be attached to a form before any rendering is done, making it useless for the thumbnail generation piece. Also seems to suffer from memory leaks.

  • GeckoFX - Works best for me, but does not properly support threading (which is critical for the thumbnail generation piece).

Any other alternatives out there?

MisterZimbu
  • 2,585
  • 3
  • 22
  • 27
  • what do you mean by "not properly support threading" I think some workaround can be created – Andrey Mar 30 '11 at 19:07
  • There is an Xpcom.Initialize call that may only be called once in GeckoFX. From what I've been able to gather once you call that method in a thread the GeckoWebBrowser control becomes bound to that thread- doing anything with a GeckoWebBrowser in any other thread results in COM errors. – MisterZimbu Mar 30 '11 at 19:27
  • 1
    as a workaround you can spawn processes that will encapsulate GeckoFX – Andrey Mar 30 '11 at 19:30
  • Yeah, that's what I've been reading and keeping as an idea in the back of my head. Sort of a last resort- the main project is already ridiculously complicated and I'd hate to add more moving parts as external processes to the mix. – MisterZimbu Mar 30 '11 at 19:32
  • Hey! I have an idea! You can try putting it in different AppDomains, it might give same benefits as separate processes and have much smaller overhead. – Andrey Mar 30 '11 at 19:39
  • Possible duplicate of [Replacing .NET WebBrowser control with a better browser, like Chrome?](https://stackoverflow.com/questions/790542/replacing-net-webbrowser-control-with-a-better-browser-like-chrome) – chillitom Sep 03 '18 at 15:58

1 Answers1

2

Can you embed WebKit.Net in a form that's shown way off the visible area of the screen?

You might also look at Mono.WebKit or Mono.Mozilla, though I've never used any of these.

Joel Coehoorn
  • 362,140
  • 107
  • 528
  • 764
  • I tried a couple tricks like that with WebKit but couldn't get it working. Doesn't mean it isn't possible- I only played with it for an hour or two. Intriguing idea with the Mono libraries though. I'll play around with that and see if I can get anywhere. – MisterZimbu Mar 30 '11 at 19:35