Web 浏览器控制的安全级别
我正在尝试将 .hta 应用程序迁移到 C# 可执行文件。当然,由于它是 .hta,因此代码全部是 HTML 和 Jscript,并调用本地 ActiveX 对象。
我创建了一个 C# 可执行项目,并且仅使用 WebBrowser 控件来显示 HTML 内容。只需将 .hta 重命名为 .html 并取出 HTA 声明即可。
一切都运行良好,除了当我调用 ActiveX 对象时,我收到一个关于在页面上运行 ActiveX 控件的安全弹出警告。
我明白为什么会发生这种情况,因为 WebBrowser 控件本质上是 IE 并使用 Internet 选项安全设置,但是有没有办法让 WebBrowser 控件绕过安全弹出窗口,或者将可执行文件或 DLL 注册为受信任的方法,而无需更改 Internet 选项中的设置?即使是在部署包上执行的方法也可以。
I am trying to migrate an .hta application to a C# executable. Of course, since it's an .hta the code is all HTML and Jscript, with calls to local ActiveX objects.
I created a C# executable project and am just using the WebBrowser control to display the HTML content. Simply renamed the .hta to an .html and took out the HTA declarations.
Everything works great, except that when I make calls to the ActiveX objects, I get a security popup warning of running an ActiveX control on the page.
I understand why this is happening since the WebBrowser control is essentially IE and uses the Internet Options security settings, but is there any way to get the WebBrowser control to bypass security popups, or a way to register the executable or DLLs as being trusted without having to change settings in Internet Options? Even a way to do on a deployment package would work as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebBrowser
是 Internet Explorer 的一个实例,继承了 IE 的安全设置。一种方法是更改 IE 中定义的安全设置。
另一种方法可能是添加自定义安全管理器 通过实施
IInternetSecurityManager
< /a> 接口。WebBrowser
is an instance of Internet Explorer, and inherits security settings from IE.One way could be to change the security settings defined in IE.
The other way could be to add a Custom Security Manager by implementing
IInternetSecurityManager
interface.