ASP.NET 2.0: Problem concerning CodeFileBaseClass

D

dieter

I am using the CodeFileBaseClass attribute of the @ Page directive to
avoid that ASP.NET generates member variables and hence hide the
variables I have defined in a base class.
This works fine as long as my base class is located in the App_Code
directory. However, when I put my base class in a separate dll, I get
the error "could not load type 'MyBase'.

Is there any possibility to have the base classes in a separate dll? I
use my base classes for several different projects - that's why they
are located in a separate dll.

Thanks in advance,
Dieter


Sample Code:



(1) test.aspx:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs"
Inherits="test" CodeFileBaseClass="MyBase"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title runat="server" id="PageTitle">Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div runat="server" id="content">Content goes here</div>
</div>
</form>
</body>
</html>


(2) test.aspx.cs:


public partial class test : MyBase
{

...

}


(3) MyBase.cs:

public class MyBase : System.Web.UI.Page
{
HtmlGenericControl content;
virtual protected void Page_Load(object sender, EventArgs e)
{
content.InnerHtml = "SuperBase";
}


}
 
B

Bruce Barker

the asp.net compiler automatically references the dll created from app_code
when compiling the page. if you have your own dll's you need to add the
referennce in the aspx page.

set the @Import and @Assembly directives.

-- bruce (sqlwork.com)
 

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,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top