Article ID: 311299 - Last Review: February 12, 2007 - Revision: 5.2 PRB: Cannot Retrieve Top-Level IWebBrowser2 Interface from a .NET UserControlThis article was previously published under Q311299 SYMPTOMS Previously, you could retrieve the top-level IWebBrowser2 reference in the SetClientSite method of the IOleObject interface as follows:
CAUSEIWebBrowser2 and the other interfaces that the browser exposes are unmanaged
functions. You must have unmanaged code permission to call unmanaged functions.
You are not granted this permission by default for controls that run in the
browser because this requires a high level of trust. Once someone has unmanaged code permission, that person can do potentially anything that he or she wants from the control. By design, UserControl objects cannot access vulnerable information in a client's computer, and UserControl objects do not need to access this information to function. RESOLUTION To retrieve the IWebBrowser2 interface and use it from within an UserControl object, you must include a managed wrapper around IWebBrowser2 that is safe to call from controls that run in the browser.
Microsoft does not currently have any wrapper classes available to accomplish
this task.
STATUSThis
behavior is by design. REFERENCESFor additional information, click the article number below
to view the article in the Microsoft Knowledge Base: 257717
(http://support.microsoft.com/kb/257717/EN-US/
)
HOWTO: Retrieve the Top-Level IWebBrowser2 Interface from an ActiveX Control
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:http://msdn.microsoft.com/ie/
(http://msdn.microsoft.com/ie/)
http://support.microsoft.com/iep (http://support.microsoft.com/iep) | Article Translations
|

Back to the top
