我试图禁用安全弹出窗口,但它仍然提示。
错误弹出:
Do you want to view only the webpage content that was delivered securely This webpage contains content that will not be delivered using a secure HTTPS connection, which could compromise the security of the entire webpage.”“This page contains both secure and nonsecure items. Do you want to display the nonsecure items?”
WPF:
<WebBrowser Name="wbGateway" Width="700" Height="600"
OverridesDefaultStyle="False"
ScrollViewer.CanContentScroll="False"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"
ScrollViewer.VerticalScrollBarVisibility="Hidden"></WebBrowser>
代码:
private void wbGateway_Navigating(object sender, NavigatingCancelEventArgs e)
{
ServicePointManager.ServerCertificateValidationCallback = new
RemoteCertificateValidationCallback(ValidateServerCertificate);
}
public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
return true;
}