Using a class without compiling it

P

Paul Darroch

Hello

I am trying to develop a class, which I will only use within my ASP.NET
site. I therefore created a class and inserted a simple test method in
it. However, when I try to use this class within my ASP.NET page, I am
told that "Type 'Class1' is not defined", I cannot seem to find out how
I can use this class, that exists within the same project as my ASP.NET
site.

The class' code is:
Namespace Test
Public Class Class1
Public Shared sTitle As String = "hallo"
End Class
End Namespace

The page's code is:
<%@ Page Language="vb" Codebehind="main.aspx.vb" %>
<%@ Import Namespace="PaulSite.test" %>
<script language="VB" runat="server">
Public Sub Page_Load(sender As Object, E As EventArgs)
Dim Data as Class1 = new Class1()
End Sub
</script>
<html>
<head><title>main</title></head>
<body></body>
</html>

I have checked the project properties in VS and it says the root
namespace is "PaulSite"

Is there anyway to use this class without compiling it?

Thanks in advance

Paul
 
M

Martin Dechev

Is there anyway to use this class without compiling it?

Only if you declare it inline in the same aspx file in which you are using
it.

Otherwise it should be compiled and the assembly should be present either in
the GAC or in the bin folder of the web application.

Hope this helps
Martin
 

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