I am creating one CCW component for C# Class Library this library contains some third party DLLs.
This user control have to use in Classic Asp page
For that purpose generated an CCW Wrapper class
In Wrapper class create interface for function declaration.
this Interface and Class contains reference of C# Class Library DLL and Third party DLL
Interface
[ComVisible(true)]
[Guid("D6F88E95-8A27-4ae6-B6DE-0542A0FC7039")]//GUID for this interface
[InterfaceType(ComInterfaceType.InterfaceIsDual)]//Enable early as well as late binding
public interface IInterface
{
[DispId(1)]
void Init();
[DispId(2)]
void OpenFile(string FileName);
[DispId(3)]
void Dispose();
[DispId(4)]
THirdPartyDLLClass ThirdPartyMethod();
}
Interface Implemented Class
[ComVisible(true)]
[Guid("13FE32AD-4BF8-495f-AB4D-6C61BD463EA4")]//GUID for this class
[ClassInterface(ClassInterfaceType.None)]//Don't generate any interface automatically. We will explicitly create one
[ComSourceInterfaces(typeof(IInterface))]//Expose events
[ProgId("CCWTEST.ClassMath")]//Friendly name of the class. Used while creating object without using 'New' keyword
public class ClassMath : IInterface
{
[ComVisible(false)]//Don't expose to COM. Can be used internally.
private ViewerControl objViewerControl = new ViewerControl(); //ref dll class file
[ComVisible(true)]
public void Init()
{
objViewerControl.Init();
}
[ComVisible(true)]
public void OpenFile(string FileName)
{
objViewerControl.OpenFile(FileName);
}
[ComVisible(true)]
public void Dispose()
{
objViewerControl.Dispose();
}
[ComVisible(true)]//
public THirdPartyDLLClass ThirdPartyMethod()
{
return THirdPartyDLLClass.ThirdPartyClassProperty;
}
}
JavaScript inside classic ASP
window.onload = onLoad;
function onLoad()
{
try
{
var obj = new ActiveXObject("CCWTEST.ClassMath");
}
catch (e)
{
alert(e.Message);
}
}
while after registering this DLL to gacutil /i and trying to access these dll into my java script code it gives me an "Undefined" Error. I don't know what going to wrong with this. for this have to install the third party DLL as well as C# Class Library into GAC