Discussion Locked

Cannot get a DLL to work using ASP.

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am starting to learn ASP and want to create an instance of an object contained in a DLL. To do this I created a simple DLL using visual basic (which worked fine when I called it from another visual basic program). The code is:

Option ExplicitOn
Option Strict On

Public Class IEECable

Public Sub New()
MyBase.New()
End Sub

Public Function multiply(ByVal a As Double, ByVal b As Double) As Double
multiply = a * b
End Function

End Class

I then created the following ASP page:

<%Option Explicit %>

<%' Begin Runtime Code

Dim objM
Set objM = Server.CreateObject("IEECable.IEECable")

Dim ans
ans=objM.multiply(3,4)
Response.Write ans
%>

When I load the page I get the following error:

Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/pages/IEEsingleCableReport.asp, line 10
800401f3

Please can someone tell me what I am doing wrong?

3 replies

by jay eckles

When you created the project in Visual Basic, did you create it as an "ActiveX DLL"? If not, that's what you need to do. I don't know specifically how to convert a project from one type to another, but with an object this small, you could just create a new project and copy/paste the source code. Recompile, and you've got a genuine COM object.

Another trick is that you have to register the DLL on the IIS server; it's not enough just to put the file on the server somewhere and try to instantiate it. I'm not an IIS administrator, but apparently there's a tool included that you use to do this registering.

If you've done both of those things and it's not working, let us know.

Good luck.

Jay Eckles
www.jayeckles.com

by steven.mcfadyen

Thanks, you answer helped me get a working solution.

Even so it was not a straight forward as it seems. I initially created the DLL using the Beta version of Visual Studio .Net. Since then I have also created an ActiveX DLL using visual basic 6(same code) and this works fine. Maybe I am doing something wrong with the .NET.

I would prefer to use the .Net. If you have any further information you can give me which would enable me to use the .Net, please e-mail me at steven.mcfadyen@leightonasia.com.

This discussion is closed to new replies.