Groups | Blog | Home
all groups > inetserver asp components > december 2005 >

inetserver asp components : Problem instantiating COM object from custom ActiveX DLL


Marja Ribbers-de Vroed
12/16/2005 11:04:32 AM
I've been provided with a custom ActiveX DLL (written in C++) that reads =
a certiifcate to generate a signature for a passed XML string, and I'm =
having trouble instantiating it.
The DLL is registered succesfully on my computer and I've explicitly =
granted IUSR_<machinename> to use it.

The DLL comes with a testtool (written in Visual Basic) which =
instantiates the object like this:

Dim loCertCryptCOM As New CCOMCRYPTLib.CCrypt

As you can see, this testtool uses "CCOMCRYPTLib.CCrypt" to instantiate =
the object from the DLL.

However, if I try to do the same from my ASP/VBscript application, like =
this:

Set l_oCertCrypt =3D Server.Createobject("CCOMCRYPTLib.CCrypt")

I get an "Server.CreateObject Failed. Invalid Class string" error.

I also have the C++ sources for this DLL and browsing those, I saw that =
the ProgID for the DLL is "CComCrypt.CCrypt" which puzzles me, since the =
VB-application uses something else for the instantiation.

To test, I tried instantiating the object like this:

Set l_oCertCrypt =3D Server.Createobject("CComCrypt.CCrypt")

and it seems to work, except that the function call that I need to =
trigger is not recognised then (error: Type mismatch: =
'l_oCertCrypt.CreateHash').

It seems strange that the Visual Basis application is successfull in =
instantiating an object that I can't instantiate from my ASP/VBscript =
webapplication.=20
And the Visual Basic application has no problem triggering the =
CreateHash() method, and I can't get that working.

Any ideas what I might be doing wrong here?

--=20
Marja Ribbers-de Vroed
12/16/2005 1:31:24 PM
I still don't understand why I need to instantiate another object in my =
ASP/VBscript application than the Visual Basic application needs to do, =
but I did find a probable cause for my problem.

For those of you who are interested:
The object's method is defined in de DLL to expect 5 parameters: 2 in =
and 3 out.=20
The 3 out parameters are declared as [out] parameters (that is, by =
reference) and they are declared as type 'string' while they should be =
declared as type 'variant' to be used from ASP.
(see: http://support.microsoft.com/kb/197957/EN-US/)

I do have the C++ sources of the DLL as well, so I will try to change =
this and see what happens then.

AddThis Social Bookmark Button