自定义IIn​​ternetSecurityManager不被调用对话 [英] Custom IInternetSecurityManager not being called with dialogs

查看:169
本文介绍了自定义IIn​​ternetSecurityManager不被调用对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,感谢您寻找。

问题描述:

我已经实现了嵌入式浏览器控件C#WinForm应用程序,并实施IInternetSecurityManager,以便允许内置页框与我们的本地安装的网页跨域访问执行我们所需要的任务。

I have implemented a c# WinForm application with the browser control embedded and have implemented IInternetSecurityManager to perform the tasks we need in order to allow cross-domain access in iframes with our locally installed web pages.

所有的事情都按预期工作与IInternetSecurityManager,的IOleClientSite,IDocHostShowUI和的IDocHostUIHandler。换句话说,我们正在被调用我们所有实现的浏览器控制

All things are working as expected with IInternetSecurityManager, IOleClientSite, IDocHostShowUI and IDocHostUIHandler. In other words, we are being called by the browser control for all of our implementations.

问题是,当在浏览器控件中加载的网页有脚本,调用window.showModalDialog():正在使用的浏览器控件实例不再与我们的客户的网站进行通信。绝对没有的QueryInterface呼叫或任何其它方法被调用在上述任何接口。

The problem is when the web page loaded in the browser control has script that calls window.showModalDialog(): The browser control instance that is being used no longer communicates with our client site. Absolutely no QueryInterface calls or any other methods are called in any of the interfaces mentioned above.

在对话框中的文件没有使用我们的安全管理器实现我假设,因为IE浏览器显示该对话框中的Web浏览器控件是不一样的一个大家叫SetClientSite()上。

The document in the dialog is not using our security manager implementation I am assuming because the web browser control in the dialog that IE displays is not the same one we called SetClientSite() on.

问:

我们怎么去跟这个新的浏览器的控制?我们需要能够给所显示被IE,我们IInternetSecurityManager实施对话框中的浏览器控制。但是,我们从来没有得到机会告诉我们的客户端站点,使挂钩了,可以这么说。换句话说,有一个从IE浏览器,它通过一个界面,上面写着:告诉我们没有通信我是通过IE浏览器创建,这里一个新的浏览器控制我的IUnknown接口,这样你有机会来我的客户的网站,等等。我们将金色的,如果有这样的通知,IE浏览器的到来。

How do we talk to this new browser control? We need to be able to give the browser control in the dialog that is shown by IE, our IInternetSecurityManager implementation. But, we never get the opportunity to tell it about our client site to make the hook up, so to speak. In other words, there is no communication from IE that tells us via an interface that says, "I am a new browser control created by IE and here is my IUnknown interface. This your chance to set my client site, etc." We would be golden if there was such a notification coming from IE.

结果是两种不同的安全环境正在使用我们的应用程序了失败,任何时候,我们都在一个对话框中使用iframe,因为我们的IInternetSecurityManager执行不使用。

The result is two different security contexts are being used and our applicaiton fails any time we are in a dialog using an iframe, because our IInternetSecurityManager implementation is not in use.

示例源$ C ​​$ C:

我已经凿离源头code,以保护无辜者:),并已减少到东西,我认为你可以在自己的Visual Studio工作2010解决方案。

I have chiseled away at source code to protect the innocent :) and have reduced down to something I think you can work with in its own Visual Studio 2010 solution.

请阅读readme.txt文件,关于该问题的信息,再现步骤,等等。

Please read the ReadMe.txt file for information on the problem, repro steps, etc.

测试网页,我写了显示信息和步骤,指导您使用的样本。

The test web pages I wrote display information and steps to guide you through the use of the sample.

请让我知道,如果你有什么,我试图完成或问题,如果样本不够清楚。

Please let me know if you have questions about what I am trying to accomplish or if the sample isn’t clear enough.

请指教。谢谢你。

http://home.comcast.net/~lowrider2112/bin/TestIEHost。 RAR

推荐答案

您可以覆盖网页浏览器的控制方法 CreateWebBrowserSiteBase

You can override the web-browser's control method CreateWebBrowserSiteBase.

protected override WebBrowserSiteBase CreateWebBrowserSiteBase()
{
    return new ExtendedWebBrowserSite(this);
} 

和实施 ExtendedWebBrowserSite 是这样的:

class ExtendedWebBrowserSite : WebBrowser.WebBrowserSite,
    IDocHostShowUI,
    IfacesEnumsStructsClasses.IServiceProvider,
    IInternetSecurityManager
    ...

这可以调用类 IInternetSecurityManager

这篇关于自定义IIn​​ternetSecurityManager不被调用对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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