dotnet interop:
Hello,
I developed a class in VB.Net that provides encryption/decryption methods.
It is to be used as a COM object from a ColdFusion program. I compiled the
class with the "Register for COM Interop" set and registered the DLL on the
ColdFusion server using RegAsm.exe. When the class' encrypt method is called
from CF I get this error:
Error on Invoke for:
COM error 0x80070057. The parameter is incorrect.
I also created a Windows test program that uses CreateObject to instantiate
the COM component and calls the encrypt and decrypt methods. This works fine
on the CF server and leads me to believe that the DLL is registered correctly
and that the methods are working.
Here is the structure of the VB.Net class. (I am implementing an interface
as suggested by the QuickStart Tutorial, although not using an interface
gives the same error):
Public Class CryptoCOM
Implements ICryptoCOM
Public Sub New()
End Sub
Public Function Encrypt(ByVal PlainText As String) As String Implements
ICryptoCOM.Encrypt
(code omitted)
End Function
Public Function Decrypt(ByVal CypherText As String) As String Implements
ICryptoCOM.Decrypt
(code omitted)
End Function
End Class
Public Interface ICryptoCOM
Function Encrypt(ByVal PlainText As String) As String
Function Decrypt(ByVal CypherText As String) As String
End Interface
Here is part the CF code:
<cfobject type="COM" class="<qualified>Security.CryptoCOM" action="Create"
name="CryptoCOM" >
<cfset userencrypted = CryptoCOM.Encrypt("username") >
It seems that everything is set up correctly and this should work without a
problem. I'm not sure whether this is a COM, ColdFusion or .Net (doubt it)
issue. But, I'm stumped. Any help is greatly appreciated.
Thanks.