Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error compiling ASP.NET 2.0 accessing custom NAMESPACE

Status
Not open for further replies.

WIREMESH

Programmer
Mar 15, 2004
109
US
I have an older asp.net application that when installed at the client runs at one site and does not at others.
The application is written in asp.net 2.0 vb. The application does not use Visual Studio. I create a directory/website under and copy the 4 files:

test_inline.ASPX
Mycomponents.vb
MyPage.vb
BIN\Mycomponents.DLL

If I run the program using the Cassini Web Server, the program runs with no error. When I run under IIS I get the error:

Namespace or type 'Mycomponents' cannot be found.

I compile the file Mycomponents.vb and copy the file Mycomponents.dll into the BIN directory.

tHIS EXAMPLE USES 3 FILES
FILE #1: test_inline.ASPX

<%@ Page Language="VB" Inherits="MyPage" Src="MyPage.vb" Debug="TRUE" AspCompat="FALSE" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.OleDb" %>
<%@ import Namespace="MyComponents" %>
<script runat="server">
PUBLIC oApp AS New MyObject
Sub Page_Load
lblHellow.text = "This is a test"
END SUB
</script>
<html>

File#2: MyPage.vb
' MyPage.vb
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HTMLControls
Imports System.Data
Imports System.Data.OleDb
Imports MyComponents

Public Class MyPage
Inherits Page
PUBLIC connection_string AS STRING

Overridable Sub Page_Load()
connection_string = ""
End Sub
End Class

file#3:mycomponents.vb
' MyComponents.vb
'
Imports System
Imports System.Data
Imports System.Data.Common
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Web

Namespace MyComponents
Public Class MyObject
Public strSQL AS STRING
end class
End Namespace
 
The application does not use Visual Studio.
no application uses VS. VS is just an IDE to ease coding.

since the application is only 4 files, create a new solution in VS or VS Express. add the exiting files (aspx and vb files). compile. deploy.

if the site is compiled you shouldn't deploy the source code. only the aspx and assemblies.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
This example is a sample application. I am having the same problem in a larger application with name forms.

Without getting into details, we do want to deploy the software with the source code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top