Create a DLL with VB.NET to use it in ASP pages

P

pons

Hi, I have to make a DLL in Visual Studio using VB.NET, then I have to
use it on a web application in ASP.
This is my class:

--------------------------------------------------------
Imports System
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.DirectoryServices

Public Class libConnessioni

Private strUserName, strPassword, strDomain As String

Public Function LDAPgetAllEmails(ByVal domain As String) As String
[...]
End Function

Public Function LDAPgetEmail(ByVal domain As String, ByVal user as
string) As String
[...]
End Function

Public Function WEBDAVgetAllEmails(ByVal uri As String) As String
[...]
End Function

Public Function WEBDAVgetEmail(ByVal uri As String, ByVal user as
string) As String
[...]
End Function

End Class
--------------------------------------------------------


I've generated a DLL, with the name of the project
("testConnessione.dll") but when I try to use it on my http://localhost/test.asp
page, in this way:


--------------------------------------------------------
<%@ Language=VBScript %>
<% Option Explicit %>
<html>
<body>
<%
set objWebDav=server.CreateObject("testConnessione.libConnessioni")
dim s
s = objWebDav.LDAPgetAllEmails("")
response.write (s)
%>
</body>
</html>
--------------------------------------------------------

I get a message that told me tha I don't have authorization to use
server.createobject...

On the server I've registered it with regasm.exe but when I try to run
this test page on the web server I got this error on the line of the
server creatobject call:

error '80070002'

Can you help me?

bye
Giulio
 
G

Guest

(e-mail address removed) wrote in @e65g2000hsc.googlegroups.com:
<%@ Language=VBScript %>
<% Option Explicit %>
<html>
<body>
<%
set objWebDav=server.CreateObject("testConnessione.libConnessioni")
dim s
s = objWebDav.LDAPgetAllEmails("")
response.write (s)
%>
</body>
</html>

Did you register the DLL with RegSvr32? Also if you need to access the DLL
via COM you need to add a bunch of attributes (such as ComClass Attribute).
 
P

pons

Did you register the DLL with RegSvr32? Also if you need to access the DLL
via COM you need to add a bunch of attributes (such as ComClass Attribute).


When I register the class I receive the messagge:

......dll was loaded, but no starting point DllRegisterServer was
found.

this file cannot be registered.

Or something like this, since I've translated it from italian.
How can I add those ComClass Attribute?

Thank you.
Giulio
 
R

Rad [Visual C# MVP]

Hi, I have to make a DLL in Visual Studio using VB.NET, then I have to
use it on a web application in ASP.
This is my class:

--------------------------------------------------------
Imports System
Imports System.Net
Imports System.IO
Imports System.Text
Imports System.Xml
Imports System.DirectoryServices

Public Class libConnessioni

Private strUserName, strPassword, strDomain As String

Public Function LDAPgetAllEmails(ByVal domain As String) As String
[...]
End Function

Public Function LDAPgetEmail(ByVal domain As String, ByVal user as
string) As String
[...]
End Function

Public Function WEBDAVgetAllEmails(ByVal uri As String) As String
[...]
End Function

Public Function WEBDAVgetEmail(ByVal uri As String, ByVal user as
string) As String
[...]
End Function

End Class
--------------------------------------------------------

I've generated a DLL, with the name of the project
("testConnessione.dll") but when I try to use it on my http://localhost/test.asp
page, in this way:

--------------------------------------------------------
<%@ Language=VBScript %>
<% Option Explicit %>
<html>
<body>
<%
set objWebDav=server.CreateObject("testConnessione.libConnessioni")
dim s
s = objWebDav.LDAPgetAllEmails("")
response.write (s)
%>
</body>
</html>
--------------------------------------------------------

I get a message that told me tha I don't have authorization to use
server.createobject...

On the server I've registered it with regasm.exe but when I try to run
this test page on the web server I got this error on the line of the
server creatobject call:

error '80070002'

Can you help me?

bye
Giulio

You need to do a bit of work to get your component to be visible by COM,
because there are a number of things you need to implement for COM
components. Read the following link in MSDN 2005 help for more details

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vbalr/html/7b07a463-bc72-4392-9ba0-9dfcb697a44f.htm
 

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

Top