1

I'm building a C# .NET winform GekoFx browser and I'm trying to display a lock icon if a webpage is secure (has valid SSL).

I tried using this code, but it shows all sites including Google as 'insecure'.

if(selectedBrowser.SecurityState == GeckoSecurityState.Secure)
            {
                button4.Image = SvgDocument.Open<SvgDocument>("icons/lock-outline.svg").Draw();
            } else if (selectedBrowser.SecurityState == GeckoSecurityState.Insecure)
            {
                button4.Image = SvgDocument.Open<SvgDocument>("icons/unlock-outline.svg").Draw();
            }

How can I successfully check if a webpage is secure or not?

Peacock
  • 302
  • 1
  • 13
  • 1
    see this: https://stackoverflow.com/questions/27689147/how-to-check-if-domain-has-ssl-certificate-or-not – jazb Feb 04 '19 at 04:34
  • @JohnB Thanks for your feedback, your comment didn't directly work for me as that was another programming language, but it did make me realize how stupid of a question I had. I realize now, all I have to do is check if the website is using HTTP or HTTPS to gain my answer. – Peacock Feb 04 '19 at 04:55

1 Answers1

1

I don't have a perfect solution but in the end, I just went with labeling HTTP sites as insecure and HTTPS sites as secure, hoping that SSL certificate errors would be taken care of by Gecko.

Peacock
  • 302
  • 1
  • 13