winforms – How to remove certificate messages from WebBrowser?

Question:

How do I remove those annoying messages showing that the page's certificate is invalid or unsafe from the System.Windows.Forms.WebBrowser component? I've tried different ways and I haven't found an alternative…

One of the alternatives was to define this property:

WebBrowser1.ScriptErrorsSuppressed = True

but it didn't work, the other one was to download a component called "GeckoFX" (the Mozilla browser) but it doesn't have any support for HTML5…

Answer:

Try calling this, before opening the webbrowser

ServicePointManager.ServerCertificateValidationCallback =
new RemoteCertificateValidationCallback(
    delegate
    { return true; }
);

Taken from this SOen answer

In fact, it is recommended that you understand the impact of ignoring these messages.

EDIT: I ended up leaving the answer in the original language. I don't program VB.Net but I think this is the equivalent.

ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(Function() True)
Scroll to Top
AllEscort