Using Business Component

B

booner

I have a business component I've built in its .vb file. Compiled the .vb
file and copied the outputted dll to the bin directory of my virtual
directory. Now in my aspx page when I attempt to utilize the business
component, I get this:

Compiler Error Message: BC30002: Type 'MyClass' is not defined

Here is the .vb file:
Imports System

Namespace myComponents

Public Class MyClass
Public Sub New()
End Sub

Public Function Authenticate(username As String, password As String) As
Boolean
return True
End Function

End Class
End Namespace

to compile the .vb file I did the following:

vbc /t:library myClass.vb

In my .aspx file:

<%@ Import Namespace="myComponents" %>

Then in some of my logic I go to use the class:

Dim misc As New MyClass

I'm using 2.0 Framework - clearly I'm a newbie (an ASP convert).

Any help you can provide would be much appreciated.

BBB
 
T

tdavisjr

This should have worked in 2.0. But try this. create a folder called
App_Code in your website directory. Then copy your myClass.vb file
there. Delete the compiled dll from the bin folder and see if you page
runs. 2.0 contains this special App_Code folder that compiles any
source file in that special folder.

Like I said, I still think what you did should have worked. The method
i'm suggesting is just an alternative to compiling the source code
yourself.
 
B

booner

Same error. I'm on a Windows 2000 box if that matters.

Looks like I have this version of the framework:

v2.0.50727
 
B

booner

No, I did not. I was not aware I needed to. What would that look like and
what does it do? Dang newbies :)
 
B

booner

Adding this to my aspx file fixed the issue:

<%@ Assembly src="myClass.vb" %>

Now to determine why. The book I'm reading makes no mention of it - and
describes compiling and placing in the bin directory as the way to do this.
 

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

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top