【发布时间】:2011-02-24 15:07:41
【问题描述】:
是否可以将 ASPX Page 指令的 Inherits 属性设置为任意程序集中的类?
我需要修改丢失源代码的 ASP.NET (1.1) 应用程序。在一个新程序集 (foo2.dll) 中,我创建了一个替换代码隐藏类,它派生自站点的代码隐藏程序集 (foo.dll) 中的原始类。将 Page 指令的 Inherits 属性设置为新的类名似乎很容易,但是当我这样做时,Web 服务器会给我Could not load type 'Foo2.checkout2'。我在 Web.config 的 <assemblies> 部分引用了新程序集。
我在文档中没有看到任何内容表明此方案不受支持,但我也不确定是否支持。
原创
<%@ Page Inherits="Foo.checkout" language="c#" Codebehind="checkout.aspx.cs" AutoEventWireup="false" %>
新的
<%@ Page Inherits="Foo2.checkout2" CodeFile="checkout2.aspx.cs" CodeFileBaseClass="Foo.checkout" language="c#" Codebehind="checkout.aspx.cs" AutoEventWireup="false" %>
【问题讨论】:
-
您是否尝试将 dll 放入站点的 bin 目录中?
-
是的,Foo2.dll 在站点的 bin 目录中。
标签: asp.net