两个文件:test.aspx,testcls.cs,在testcls.cs文件中定义了一个类myclass(namespace是test),然后在test.aspx中调用
<%@ Page language="c#" Codebehind="testcls.cs" AutoEventWireup="false" Inherits="testcls" %>
但是在定义类变量时(testcls tcls=new testcls();)却提示错误了。
因为初学ASP.NET,所以不是很明白。
我将test.aspx中的引用改成<%@ Page Language="C#" AutoEventWireup="false" CodeFile="testcls.cs" Inherits="myClass" %>却提示如下错误,这是什么原因啊?
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 1: // testcls.cs
Line 2:
Line 3: using System;
Source File: f:\testcls.cs Line: 1