1

I have instantiated a WebBrowser object. When I use it to Navigate to a specific URL I need it to get to, I get the following error message:

The website’s security certificate is not secure.

Error code: 0

The problem is that I can't get past this error on the WebBrowser.

However, if I go to the same URL using Internet Explorer 11, I get a similar (maybe the same?) error but with a little bit of more information:

Your PC doesn’t trust this website’s security certificate.
The hostname in the website’s security certificate differs from the website you are trying to visit. 
Error Code: DLG_FLAGS_INVALID_CA
DLG_FLAGS_SEC_CERT_CN_INVALID

And it provides me the option Go on to the webpage (not recommended).

This is the code I'm using to navigate to the webpage:

WebBrowser wb = new WebBrowser();
wb.ScriptErrorsSuppressed = true;
wb.Navigate(url);
wb.Dock = DockStyle.Fill;

And later on I add wb to Controls.

I need my application to either ignore the error and proceed to the webpage or to provide the option of going to the webpage in a similar fashion as Internet Explorer 11 does.

How can I do this?

ArthurTheLearner
  • 315
  • 4
  • 12
  • Are you saying that having the application automatically find and click the proceed button on the warning page is not an acceptable solution? – Alexander Ryan Baggett Aug 06 '19 at 15:14
  • Are you using http or https? Use a sniffer like wireshark or fiddler and compare the http header in the IE 11 with the headers in your c# application. Make the headers in c# look like IE 11. – jdweng Aug 06 '19 at 15:14
  • 1
    @PavelAnikhouski, its not quite a duplicate. The answer to that question does not address his problem. That answer only displays an error message. He is seeking to bypass the warning screen and proceed to the intended page. – Alexander Ryan Baggett Aug 06 '19 at 15:16
  • @AlexanderRyanBaggett Having the application automatically find and click the proceed button would be acceptable, but the thing is that it doesn't appear on the application. That's what I meant with the "provide the option of going to the webpage in a similar fashion as Internet Explorer 11 does" part. How can I make it appear? – ArthurTheLearner Aug 06 '19 at 15:18
  • @ArthurTheLearner, this may be a longshot, since I am not in a position to test it, but have you tried using the [registry keys](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330735(v=vs.85)#ssl-security-alert-display) around SLL warnings? – Alexander Ryan Baggett Aug 06 '19 at 15:28
  • @rené-vogt Hello, René. My question isn't a duplicate of the one you're pointing out. That question asks how to show different error messages depending on the default error message shown by a webpage. My question is about getting past the untrusted certificate error (like "go on anyway"), not about showing something different on screen. Could you please unmark it? – ArthurTheLearner Aug 08 '19 at 09:36
  • @AlexanderRyanBaggett I've tested both the registry keys "Security Certificate Revocation Failure" and "SSL Security Alert Display" as suggested by your link without success on Internet Explorer. – ArthurTheLearner Aug 08 '19 at 11:16

1 Answers1

0

The error went away as soon as I installed the certificate.

ArthurTheLearner
  • 315
  • 4
  • 12