Help, can't reference new dll?????????

G

Guest

In VS 6.0 it was easy to create a new dll, compile it, and all the vb runtime
files were nicely added to it via the references that you gave.
Then in an ASP page youjust referenced, after registering it, like:
dll = sbsuserinfo
class = cluserinfo
function = CheckLogin

' Let's go write the record to db and create cookie if selected
Dim myobj
Set myobj = server.CreateObject("sbsuserinfo.cluserinfo")
if myobj.CheckLogin(d1,d2,d3) = 1 then
'Response.Write "<h1>Login Successful!</h1>"
Response.Redirect "Default.asp"
else
' Do nothing. Login unsuccessful!
End If

Set myobj = nothing

I can't seem to get this right in ASP.NET. I've created the new dll, a .vb
file that I compiled. I've added it to my VS.NET project as a reference and
it's in the /bin, but how do I now use those classes in the dll? I created
one test class and one function to pass two values, thus returning them back
slightly changed.

I want to reference this new dll and it's class/functions in my code-behind.
How can I do this? I've tried making the .vb code I complied into a
namespace to see it, but the functions, etc. are not available??????

Help..........
 
G

Guest

ok, I think I've figured most of it out.
I created a .vb file and made a new namespace in it. I compiled it and added
to my project. I then used:
Dim ns1 As New ns1.cl1
and then I saw it on my code-behind.

Question: does it have to be a namespace? I assume yes. And do the
functions, etc. have to be made public???

as a test, I created this .vb then compiled to dll:

Imports System
Imports System.Web

Namespace ns1

Class cl1

Public Function login(ByVal loginname As String, ByVal loginpassword
As String) As Integer
'HttpContext.Current.Response.Write("login: " & loginname &
"<br>")
'HttpContext.Current.Response.Write("password: " & loginpassword
& "<br>")
If loginname = "test" Then
HttpContext.Current.Session("login") = True
Else
HttpContext.Current.Session("login") = False
End If
login = 1

End Function

End Class
 
S

Scott Allen

Hi Chris:

The new classes do not have to be in a different namespace, but that is the
generally accepted practice.

The functions do have to be public for you to call them from outside the
project.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,999
Messages
2,570,243
Members
46,836
Latest member
login dogas

Latest Threads

Top