0

I have a fairly complex dll which contains two namespaces, as well as a few classes that do not belong to a namespace at all.

For the sake of simplicity, I have a test dll which has two classes in it:

namespace MyAsmNamespace{
    public MyClass{
       public int doSomething(){ return 1;}
    }
}

and

public MySecondClass{
    public int doSomethingElse(){ return 2;}
}

I am trying to use objects from this dll within a classic ASP page, using CreateObject.

I have registered the dll using >RegAsm.exe /codebase /tlb

And then I load the dll using set obj = CreateObject("MyAsmNamespace.MyClass")

Now the classes with namespaces specified work just fine, but for the class that doesn't have a namespace, I don't know what to do. I tried set obj = CreateObject("MySecondClass"), but that doesn't work (I get an ActiveX Component Can't Create Object error)

I looked in IL DASM, and MySecondClass is in the assembly, but not listed under a namespace. Looking in regedit, I can see that MyAsmNamespace.MyClass is registered, but I cannot find MySecondClass anywhere.

Does MySecondClass have to be in a namespace to be referenced in classic asp or is there a default namespace it becomes a part of?

1
  • Does the second class have any attributes, like ComVisible? Any other differences, besides the namespace?
    – noseratio
    Oct 4, 2013 at 23:43

1 Answer 1

0

After several days working on this, I have not found a way to reference a class inside an assembly using CreateObject if that class was not placed inside of a namespace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.