C
coenve
We use ActiveX control to render images server-side in code-behind.
Reference is added to the project, Interop assembly is created, project
compiles, builds, all's fine. All files are moved to the testserver, ocx
that hosts the control that's interoped is registered with regsvr32. On the
line that creates the object:
obj = (MyLib.chart)Server.CreateObject("MyLib.chart");
Server throws an exception: System.InvalidCastException: Specified cast is
not valid.
Control is registered correctly, as I can see it clearly in OleView. The
only thing that I can think of is that somehow what CreateObject returns is
not the type that Interop says it should be. I've read that if 2 developers
create interop for one COM object, those 2 resultant interops will not be
type-compatible, which rings my bell because of 'cast not valid' exception,
however I have just one interop file here.
I would be glad to hear any suggestions, i'm a bit stuck with this.
Reference is added to the project, Interop assembly is created, project
compiles, builds, all's fine. All files are moved to the testserver, ocx
that hosts the control that's interoped is registered with regsvr32. On the
line that creates the object:
obj = (MyLib.chart)Server.CreateObject("MyLib.chart");
Server throws an exception: System.InvalidCastException: Specified cast is
not valid.
Control is registered correctly, as I can see it clearly in OleView. The
only thing that I can think of is that somehow what CreateObject returns is
not the type that Interop says it should be. I've read that if 2 developers
create interop for one COM object, those 2 resultant interops will not be
type-compatible, which rings my bell because of 'cast not valid' exception,
however I have just one interop file here.
I would be glad to hear any suggestions, i'm a bit stuck with this.