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)
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate);
The best idea is to sort out the broken certificate. Browsers guard these warnings for a reason. What you're doing is trying to circumvent the user's safety.
If you must do this using the webbrowser control, then set ScriptErrorsSuppressed to true.