Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

AppDomain Remoting from WebBrowser Control through to Hosted IE Control


I'm struggling with an issue here.

The .Net2.0 application i'm developing makes use of both the
WebBrowser control and controls hosted with this.

When the document has loaded i check the DOM through an
GetElementsByTagName( "object" ) call to get references to the objects
hosted in IE.

This provides me with access to a proxy to the hosted object which i
access as follows:

HtmlElementCollection elems =
m_browser.Document.GetElementsByTagName( "object" );

foreach ( HtmlElement elem in elems )
    HTMLObjectElement obj = elem.DomElement as HTMLObjectElement;

    ( obj.@object as BaseHosted ).RegisterClient( m_handler );


I am able to call methods on the proxy as if it were an instance of
BaseHosted (which the hosted control derives from) however when I try
and register an interface to be called back on ( RegisterClient )
which takes an interface (of type IMapControlClient) in this case
implemented by m_handler (which derives from MarshalByRefObject) the
call fails:

System.Runtime.Remoting.RemotingException: The argument type
'System.MarshalByRefObject' cannot be converted into parameter type
'IMapControlClient'. ---> System.InvalidCastException: Object must
implement IConvertible.

Now i'm guessing that there is something in the remoting chain which
is refusing to marshal this object reference across the app domain
boundary. I'm also guessing the some sort of COM is involved along the

Has anyone managed to get this to work and if so how?? If not can
anyone suggest what might be happening?

Kind regards,

Nick Vaughan.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc