How to call non-COM legacy dll from ASP.NET -OR- write COM wrapper in C#

C

Chris Bordeman

Using VS2008.

Have an old straight C style dll, need to call it from ASP.NET. This
normally works easily using DllImport but ASP.NET apparently doesn't let you
call C dlls directly.

So I heard you can call COM dlls by just adding a reference. So I created a
C# class library with a single class that wraps and calls my C dll through
DllImport. I checked the 'Make COM Visibile' option and compiled. Used
regasm.exe to register the dll w/ COM, which reported success.

But I do 'add reference' on the ASP.NET app and the object is not to be
found on the COM list.

Isn't it supposed to show up?

Is there a better way? Or a way to avoid COM altogether?
 
C

Chris Bordeman

OK I though I was really clear I *know* how to do basic native DLL calls.
ASP.NET doesn't allow DllImport and can only call .Net code directly.
THAT'S the problem.

I appreciate your response, but please read the question in it's entirety
before answering.

(I knew someone would do this <g>)
 
C

Chris Bordeman

As I said, I tried to create one and then registered it using regasm.exe
(which supposedly succeeded) but for whatever reason now I don't see jack on
the COM list on the 'Add Reference' window.
 
J

Jeff Dillon

Now YOU didn't read my message. You need to Browse for it...it might not
show in the list

Jeff
"Chris Bordeman"
 
C

Chris Bordeman

I read that, but remember this is a .Net DLL with COM interfaces so loading
it by file just gets you a .Net reference. If it's gonna be seen by VS as
COM, it needs to be loaded via the COM list.

I've abandoned the COM route, looking for a a way to do this via remoting.

Thanks for your help.
 
C

Cowboy \(Gregory A. Beamer\)

Let me see if I have it right.

DLL in question is C.
You need to call it from ASP.NET.

If so the article is correct. You may have to wrap the DLL in a .NET
library, but it should work. WIth ASP.NET it should also be able to be
called from a ASP.NET web application instead of a ASP.NET web site. If it
does not work, wrap it.

I see no reason to wrap in .NET and then create a COM callable wrapper and
then call that. It creates something twice removed instead of something once
removed.

Am I still missing something?


"Chris Bordeman"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top