views:

76

answers:

1

How do I access a COM component from an ASP.NET page. I added reference to my ASP.NET project.

The actual dll I got from the 3rd party is ePadIIu.dll but when I added it to the ASP.NET project it shows as ePadIIu.interop.

I want to access all the methods and properties in the component.

The sample I received from the 3rd party software uses vbscript to access all the methods.

How do I use those methods in the code behind from default.aspx.vb.

+3  A: 

When you added the reference to the COM component from your ASP.NET project, Visual Studio ran it through tblimp (type library import utility) to generate an interop assembly for use with .NET. By convention, it named it ePadIIu.interop.dll.

If you view this reference in the Object Browser, you should be able to determine the namespace you will need to reference, as well as any of the classes, properties and methods exposed.

Your using statement at the top of your *.cs might look something like this:

using ePadIIu;

Caution - Slippery When Wet
VB COM components are notorious for being compiled using a Single Threaded Apartment (STA) - though not always the case (if I remember correctly). If ePadIIu happens to be a STA COM component you might experience:

  1. Slower performance
  2. Possible memory leak due to blocked finalizer (not trying to be all doom and gloom, just seems to happen more often than not)

References discussing the problem:

Good Luck!
Z

Zach Bonham