没有App_Code,如何使用ASP.NET控件?

ASP.NET1.0和ASP.NET1.1没有App_Code功能,使用自己定义的控件时,需要@Register 指令:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %><%@ Register TagPrefix="WebApp" Namespace="WebApplication1" Assembly = "WebApplication1" %>

然后在页面中使用:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %><WebApp:myControl runat="server" />

如果有多个页面使用时需要在Web.config中配置一下,接下来再学习一下<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>