VB.NET WebBrowser控件绕过SSL证书检查技术求助
Hey Matt, I’ve run into this exact issue with the VB.NET WebBrowser control before—super frustrating when IE11 lets you click through but your app just blocks the site. Let’s break down the fixes that actually work:
The core problem here is that the WebBrowser control doesn’t automatically display IE11’s "Continue to website" prompt. You’ll need to either handle the error programmatically or adjust system-level trust settings. Here are the most reliable solutions:
1. Handle the CertificateError Event (Recommended, App-Specific)
When using IE11 emulation, the WebBrowser exposes a CertificateError event that lets you override the default rejection of untrusted certs. Here’s how to implement it in your VB.NET app:
First, wire up the event to your WebBrowser control (you can do this in the designer, or add it manually in your form’s constructor):
AddHandler WebBrowser1.CertificateError, AddressOf WebBrowser1_CertificateErrorThen add the event handler method to allow trusted self-signed certs:
Private Sub WebBrowser1_CertificateError(sender As Object, e As WebBrowserCertificateErrorEventArgs) ' Target common self-signed cert error codes ' 0x800B010A = Untrusted root certificate ' 0x800B0109 = Invalid certificate chain If e.ErrorCode = &H800B010A Or e.ErrorCode = &H800B0109 Then ' Allow navigation to proceed e.Handled = True End If End SubPro tip: For extra security, add a check to verify the certificate’s thumbprint matches your trusted cert—this prevents allowing any random untrusted cert.
2. Add the Cert to the Trusted Root Store (System-Wide Fix)
If you want all apps using the IE11 kernel (including your VB.NET app and IE11 itself) to trust the cert, install it to your system’s trusted root store:
- Open IE11, navigate to the site, and when the warning pops up, click View certificate > Install Certificate
- Choose Local Machine (you’ll need admin rights) and follow the wizard to place the cert in the Trusted Root Certification Authorities store
- Restart your VB.NET app—this should eliminate the error entirely without code changes.
3. Adjust IE Security Zone Settings (Quick, Less Secure)
For a quick fix, tweak IE’s security settings to allow invalid certs for your site’s zone:
- Open IE11, go to Internet Options > Security tab
- Select the zone your site belongs to (e.g., Intranet or Trusted Sites)
- Click Custom level..., scroll to Miscellaneous, and set Allow invalid certificates for resources in this zone to Enable
- Apply changes and restart your app. Note: This is less secure because it allows all invalid certs in that zone, not just your specific one.
内容的提问来源于stack exchange,提问作者Matt

