【问题标题】:.NET webbrowser security prompt.NET 网络浏览器安全提示
【发布时间】:2011-11-09 00:14:06
【问题描述】:

我正在为 Windows 窗体使用 .NET Web 浏览控件。 每次我访问这个特定的网页时,我都会得到这个特定的提示: http://screensnapr.com/v/fS15lG.png

这个唠叨框会打乱程序流程。 我已经尝试了这篇文章中接受的答案: How to disable "Security Alert" window in Webbrowser control 但它并没有阻止提示。

有没有办法通过代码禁用它。

【问题讨论】:

  • 仅供参考,您没有使用 C# WebBrowser 控件。您正在使用 .NET Windows 窗体 Web 浏览器控件。

标签: c# winforms automation webbrowser-control mshtml


【解决方案1】:

我不知道,问题是您的某些内容通过 https 和一些通过 http 提供,请将页面中项目的 url 更改为以 https:// 开头,或者最好将它们更改为 //<domain>/path/to/item.ext 注意省略 http:https: 以便通过您连接的任何传输请求资源。

【讨论】:

  • 每当我将其设置为http时,它都会更改为https,我别无选择。
  • 确保所有资源(图像/CSS/JS)都以 // 而不是 http:// 为前缀
【解决方案2】:

这是一个安全区域设置,您可以通过安装自己的 IInternetSecurityManager implementation 来覆盖它。 MSHTML calls the QueryInterface method on the IOleClientSite interface to get the IServiceProvider interface in order to query your IInternetSecurityManager implementation,这意味着您需要从 System.Windows.Forms.WebBrowser.WebBrowserSite 派生才能添加 IServiceProvider 实现。

【讨论】:

    猜你喜欢
    • 2011-10-06
    • 1970-01-01
    • 2019-06-19
    • 1970-01-01
    • 2011-06-02
    • 2012-12-24
    • 1970-01-01
    • 2012-10-30
    • 1970-01-01
    相关资源
    最近更新 更多