How to programmatically answer "Yes" to WebBrowser control security alert
Posted
by
ih8ie8
on Stack Overflow
See other posts from Stack Overflow
or by ih8ie8
Published on 2012-10-21T16:26:37Z
Indexed on
2012/10/21
17:00 UTC
Read the original article
Hit count: 526
I am using WebBrowser control to programmatically access a single website, but whenever I login, I receive this certificate security alert:
Since I trust that website and since I need to programmatically automate the login as well, this dialog box gets in the way.
I searched SO for a solution and found a question similar to mine, but the accepted answer does not work!
I defined a static member in the form that contains the WebControl:
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}
In my form's constructor I added:
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
But that didn't get rid of the certificate security alert.
Is there any way to get rid of this warning?
Is there an IE equivalent to Firefox's Add Security Exception???
Note: The owner's certificate works perfectly fine (without exhibiting this security alert) with standalone browsers (IE, FF, Chrome, Safari). It only exhibits the problem with the WebBroswer control.
© Stack Overflow or respective owner