WebBrowser控件 - 忽略SSL错误 [英] WebBrowser control - ignore SSL errors

查看:186
本文介绍了WebBrowser控件 - 忽略SSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多小时的搜索都没有得出答案。我们正在寻找一种方法,.NET WebBrowser控件可以导航到具有SSL安全问题的页面(自签名证书或不匹配的主机名),而无需停止并显示错误页面:

Many hours of searching has not lead to an answer. We're looking for a way that a .NET WebBrowser control can navigate to pages with SSL security problems (self-signed certificates or non-matching hostnames) without stopping and displaying the error page:

我已经看到许多帖子已经关闭:

I've already seen many posts that are close:

如何在Web浏览器控件中禁用安全警报窗口 - 不起作用,因为WebBrowser显然不使用ServicePointManager

How to disable "Security Alert" window in Webbrowser control -- doesn't work because WebBrowser apparently doesn't use the ServicePointManager

抑制托管WebBrowser控制对话框 - 取决于知道窗口标题,这对非英语读者不起作用

Suppressing Hosted WebBrowser Control Dialogs -- depends on knowing window titles, which doesn't work for a non-English audience

C#WebBrowser控件 - 忽略网站安全警告 - 这是一个副本关闭,答案只是参考上面的链接。

C# WebBrowser Control - ignore website security warnings -- this was closed as a duplicate, and the answer just referred to the above link.

大多数表单帖子建议实现我已经完成的IInternetSecurityManager,但无济于事。

为所有URL(指定URLZONE_LOCAL_MACHINE或URLZONE_TRUSTED)响应GetSecurityId的常量值不起作用。

Most form posts suggest implementing IInternetSecurityManager, which I've done, but to no avail.
Responding with a constant value for GetSecurityId for all URLs (specifying URLZONE_LOCAL_MACHINE or URLZONE_TRUSTED) doesn't work.

以下内容无效:

public unsafe int MapUrlToZone(string url, int* pdwZone, int dwFlags)
{
    *pdwZone = 3; // URLZONE_TRUSTED;
    return Win32.S_OK;
}

最后,我似乎无法为ProcessUrlAction找到任何方法效果:

Finally, I can't seem to find a way for ProcessUrlAction to have any effect:

public unsafe int ProcessUrlAction(string url, int dwAction, byte* pPolicy, int cbPolicy,
            byte* pContext, int cbContext, int dwFlags, int dwReserved)
{
    *((int*)pPolicy) = (int)Win32.UrlPolicy.URLPOLICY_ALLOW;
    return Win32.S_OK;
}

有没有人成功找到超越SSL警告页面的方法?

Has anyone successfully found a way past that SSL warning page?

推荐答案

您需要实现的接口是IHttpSecurity。请参见 http:// jiangsheng .net / 2013/07/17 / howto-ignoring-web-browser-certificate-errors-in-webbrowser-host / 基于Windows窗体的示例。

the interface you need to implement is IHttpSecurity. See http://jiangsheng.net/2013/07/17/howto-ignoring-web-browser-certificate-errors-in-webbrowser-host/ for an example based on Windows Forms.

这篇关于WebBrowser控件 - 忽略SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆