如何禁用“安全警报” Webbrowser 控件中的窗口
我正在使用 Webbrowser 控件使用“不受信任的证书”登录 HTTPS 站点。 但我收到关于不受信任证书的弹出式标准窗口“安全警报”:
我必须按标题找到此窗口并发送Alt+Y以按是:
int iHandle = NativeWin32.FindWindow(null, "Security Alert");
NativeWin32.SetForegroundWindow(iHandle);
System.Windows.Forms.SendKeys.Send("Y%");
但用户可以看到此窗口闪烁。
如何忽略此警报?
或者在 Webbrowser 控件中禁用此“不受信任的证书”检查?
I'm using Webbrowser control to login to HTTPS site with "untrusted certificate".
but I get popup such standart window "Security Alert" about untrusted certificate:
I have to find this window by title and send it Alt+Y to press Yes:
int iHandle = NativeWin32.FindWindow(null, "Security Alert");
NativeWin32.SetForegroundWindow(iHandle);
System.Windows.Forms.SendKeys.Send("Y%");
but user can see a flickering of this window.
How can I ignore this alert?
Or disable this "untrusted certificate" check in Webbrowser control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这应该可以做到:
显然,盲目地允许证书是一种安全风险。 当心。
This should do it:
Obviously, blindingly allowing certificates is a security risk. Be careful.
如果证书不是来自受信任的证书颁发机构(提示中的第一点),那么您可以在相关 PC 上的受信任的根证书颁发机构下安装证书。
您可以在“查看证书”下执行此操作。
在某些方面,这可能是一个更简单的解决方案,因为它不需要任何接受任何和所有证书的代码更改。 但是,它确实要求在使用应用程序的任何地方安装证书。
If the certificate isn't from a trusted certifying authority (the first point in the prompt) then you could install the certificate under the Trusted Root Certification Authorities on the PCs in question.
You can do this under View Certificate.
In some ways this could be a simpler solution as it doesn't require any code changes that accept any and all certificates. It does however require the certificate to be installed wherever the application is used.
在这里,我们提出解决方案:
我在 Browser_Naviged 事件上运行它,因为在此之前底层 ActiveX 组件为空。
参考:https://social.msdn.microsoft.com/Forums/vstudio/en-US/4f686de1-8884-4a8d-8ec5- ae4eff8ce6db/new-wpf-webbrowser-how-do-i-suppress-script-errors?forum=wpf
Here,we go with the solution:
I run it on the Browser_Navigated event as the underlying activeX component is null until then.
Ref:https://social.msdn.microsoft.com/Forums/vstudio/en-US/4f686de1-8884-4a8d-8ec5-ae4eff8ce6db/new-wpf-webbrowser-how-do-i-suppress-script-errors?forum=wpf
当我将 WebBrowser.ScriptErrorsSuppressed 属性设置为 false 时,我不再收到这些弹出窗口
When I set the WebBrowser.ScriptErrorsSuppressed property to false, I do not get these popups anymore
我看到了这个解决方案。它对我有用。它非常简单。
I see this solution.it work for me.It very easy way.