<bdo id='WBPN9'></bdo><ul id='WBPN9'></ul>

<small id='WBPN9'></small><noframes id='WBPN9'>

  • <i id='WBPN9'><tr id='WBPN9'><dt id='WBPN9'><q id='WBPN9'><span id='WBPN9'><b id='WBPN9'><form id='WBPN9'><ins id='WBPN9'></ins><ul id='WBPN9'></ul><sub id='WBPN9'></sub></form><legend id='WBPN9'></legend><bdo id='WBPN9'><pre id='WBPN9'><center id='WBPN9'></center></pre></bdo></b><th id='WBPN9'></th></span></q></dt></tr></i><div id='WBPN9'><tfoot id='WBPN9'></tfoot><dl id='WBPN9'><fieldset id='WBPN9'></fieldset></dl></div>

        <legend id='WBPN9'><style id='WBPN9'><dir id='WBPN9'><q id='WBPN9'></q></dir></style></legend>
        <tfoot id='WBPN9'></tfoot>

        自定义 IInternetSecurityManager 未通过对话框调用

        时间:2023-09-14

            <bdo id='iZIL4'></bdo><ul id='iZIL4'></ul>
                  <tbody id='iZIL4'></tbody>
                <tfoot id='iZIL4'></tfoot>
              • <small id='iZIL4'></small><noframes id='iZIL4'>

                <i id='iZIL4'><tr id='iZIL4'><dt id='iZIL4'><q id='iZIL4'><span id='iZIL4'><b id='iZIL4'><form id='iZIL4'><ins id='iZIL4'></ins><ul id='iZIL4'></ul><sub id='iZIL4'></sub></form><legend id='iZIL4'></legend><bdo id='iZIL4'><pre id='iZIL4'><center id='iZIL4'></center></pre></bdo></b><th id='iZIL4'></th></span></q></dt></tr></i><div id='iZIL4'><tfoot id='iZIL4'></tfoot><dl id='iZIL4'><fieldset id='iZIL4'></fieldset></dl></div>

                <legend id='iZIL4'><style id='iZIL4'><dir id='iZIL4'><q id='iZIL4'></q></dir></style></legend>
                  本文介绍了自定义 IInternetSecurityManager 未通过对话框调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  您好,感谢您的关注.

                  问题描述:

                  我已经实现了一个嵌入了浏览器控件的 c# WinForm 应用程序,并实现了 IInternetSecurityManager 来执行我们需要的任务,以便允许在 iframe 中使用我们本地安装的网页进行跨域访问.

                  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.

                  示例源代码:

                  我已经对源代码进行了精心设计以保护无辜者 :) 并简化为我认为您可以在其自己的 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.

                  这篇关于自定义 IInternetSecurityManager 未通过对话框调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 C# 中手动复制文件时显示复制文件对话框/表单? 下一篇:使用 2 DialogForm 删除数据

                  相关文章

                    1. <small id='C1PtN'></small><noframes id='C1PtN'>

                      <i id='C1PtN'><tr id='C1PtN'><dt id='C1PtN'><q id='C1PtN'><span id='C1PtN'><b id='C1PtN'><form id='C1PtN'><ins id='C1PtN'></ins><ul id='C1PtN'></ul><sub id='C1PtN'></sub></form><legend id='C1PtN'></legend><bdo id='C1PtN'><pre id='C1PtN'><center id='C1PtN'></center></pre></bdo></b><th id='C1PtN'></th></span></q></dt></tr></i><div id='C1PtN'><tfoot id='C1PtN'></tfoot><dl id='C1PtN'><fieldset id='C1PtN'></fieldset></dl></div>
                        <bdo id='C1PtN'></bdo><ul id='C1PtN'></ul>
                      <legend id='C1PtN'><style id='C1PtN'><dir id='C1PtN'><q id='C1PtN'></q></dir></style></legend>

                    2. <tfoot id='C1PtN'></tfoot>