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";
}
}
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";
}
}