Business Objects?

A

Arpan

This is how I am creating a simple business object:

'This code exists in a class file named MyDatabase.vb
Imports System
Imports System.Data
Imports System.Data.SqlClient

Namespace ASPNETDB
Public Class MyDatabase
End Class
End Namespace

The above VB file exists in the the folder
C:\Inetpub\wwwroot\ASPX\Business.

This is the command I am using in a command prompt window to compile
the above VB file into a DLL file named ASPNETDB.dll (after compiling,
the DLL will be created in the folder C:\Inetpub\wwwroot\ASPX\bin):

C:\Inetpub\wwwroot\ASPX\bin>C:\WINNT\Microsoft.NET\Framework\v2.0.50727\vbc.exe
/t:library /out:ASPNETDB.dll /r:System.dll /r:System.Data.dll
...\Business\MyDatabase.vb

The above command successfully creates ASPNETDB.dll in the
C:\Inetpub\wwwroot\ASPX\bin\ folder but when I try to access this
business object in an ASPX page using the following simple code:

<%@ Import Namespace="ASPNETDB" %>
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)
Dim boDatabase As New MyDatabase
lblMessage.Text = "Object Created"
End Sub
</script>

<form runat="server">
<asp:Label ID="lblMessage" runat="server"/>
</form>

ASP.NET generates the following error:

Type 'MyDatabase' is not defined.

pointing to the Dim boDatabase As New MyDatabase line.

Can someone please point out where am I going wrong?

Thanks,

Arpan
 
T

Tim_Mac

hi Arpan,
it sounds like the ASPX folder is not an 'application' in IIS. if you go
into the IIS manager and right-click the ASPX folder, open Properties, if
the Application Name box is greyed out, click the 'Create' button and this
should solve your problem. if this is the case then your bin folder isn't
in the 'root' of an application so it is ignored by the framework.

hope this helps
tim
 
A

Arpan

Thanks a million times, Tim. You have hit the nail on the head. The
"ASPX" folder wasn't an application. So after setting it as an
application in the IIS, it's working now.

Regards,

Arpan
 

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