处理 .NET WebBrowser 控件中的安全消息

发布于 2024-08-22 09:56:50 字数 411 浏览 8 评论 0原文

我正在尝试编写一个 VB.net 应用程序,该应用程序将允许用户在 html/jscript 中创建自己的小部件插件,并且我想在应用程序设置中设置自己的安全选项,允许用户选择可以运行或不运行的内容,例如脚本,闪存、Activex。

我想允许在没有 WebBrowser 控件中的 Windows 安全对话框的情况下使用 ActiveX 控件(ActiveX 控件正在尝试与页面交互...)或它所说的任何内容。

我开始自定义 WB 控件以满足我的需要,实现各种接口,例如 IOleClientSite、IDocHostShowUI、IDocHostUIHandler 等...

我似乎找不到任何可以让我控制 WB 控件的安全权限的东西。我尝试实现 IHttpSecurity 和 IInternetSecurityManager 但我要么找错了树,要么做得不对。

I am attempting to write a VB.net application which will allow users to create their own widget plugins in html/jscript and i would like to set my own security options in the applications settings allowing users to choose what can run or not eg scripts, flash, activex.

I would like to allow activex controls to be used without the windows security dialog in the WebBrowser Control (An ActiveX control is trying to interact with the page...) or what ever it says.

I started customizing the WB Control to suite my needs implementing various interfaces such as IOleClientSite, IDocHostShowUI, IDocHostUIHandler, etc...

I can't seem to find anything that will allow me to control the security permissions of the WB Control. I tried to implement IHttpSecurity and IInternetSecurityManager but I'm either barking up the wrong tree or not doing it right.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

最偏执的依靠 2024-08-29 09:56:50

使用此代码:

Public WithEvents Security as WebBrowserSecurityAlerts
Public Sub Security_Show(sender as object, e as WebBrowserSecurityAlertsEventArgs) Handles Security.Show
MSGBOX (e.Info.Encryption & vbnewline & e.Info.Identity)
End Sub

在 WebBrowser 中处理

Use this code:

Public WithEvents Security as WebBrowserSecurityAlerts
Public Sub Security_Show(sender as object, e as WebBrowserSecurityAlertsEventArgs) Handles Security.Show
MSGBOX (e.Info.Encryption & vbnewline & e.Info.Identity)
End Sub

Handle in WebBrowser

老旧海报 2024-08-29 09:56:50

WebBrowser 控件只是 Internet Explorer 的另一个实例,因此继承了 IE 中的安全设置。

除了在 IE 本身中编辑它们之外,我没有找到其他更改安全选项的方法。您很可能也可以更改注册表中的设置,但它们对于所有 IE 实例都是全局的。如果您在代码中更改它,那么您也可以为所有浏览器实例更改它。

在我不久前编写的一个自动化应用程序中,我通过监视窗口弹出窗口、抓住窗口句柄并向该窗口中的按钮发送单击来处理弹出窗口。当然不是一个优雅的解决方案:(

The WebBrowser control is just another instance of Internet Explorer, and thus inherits the security settings in IE.

I have found no other way of changing the security options than to edit them in IE itself. You can most likely change the settings in registry as well, but they will be global for all IE instances. If you change it in your code, then you change it for all browser instances as well.

In an automated application I wrote some time ago I disposed of the pop-ups by monitoring for window pop-ups, grabbing the window handle and sending a click to the button in that window. Certainly not an elegant solution :(

风筝有风,海豚有海 2024-08-29 09:56:50

IInternetSecurityManager 需要 IQueryInterface。
我的应用程序中没有实现 IQueryInterface,这就是它无法工作的原因。

IInternetSecurityManager requires IQueryInterface.
I didn't have IQueryInterface implemented in my application which was why it wasn't working.

凤舞天涯 2024-08-29 09:56:50

IHttpSecurity 和 IInternetSecurityManager 应该可以工作,您的实现是什么样的?检查 https://learn .microsoft.com/en-us/previous-versions/windows/desktop/cc507439%28v%3dvs.85%29 为例。

IHttpSecurity and IInternetSecurityManager should work, how is your implementation look like? Check https://learn.microsoft.com/en-us/previous-versions/windows/desktop/cc507439%28v%3dvs.85%29 for an example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文