0

好的,我的 Home.aspx 出现以下错误,代码如下

错误:

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 5:  using System.Web.UI.WebControls;
Line 6:  
Line 7:  public partial class home : _BasePage
Line 8:  {
Line 9:      protected void Page_Load(object sender, EventArgs e)

Source File: h:\Sites\BaseSite\Home.aspx.cs    Line: 7 

代码:

public partial class home : _BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {


    }
}

现在我明白这是因为它应该继承:System.Web.UI.Page

然而,这是我的 _Basepage 类:

using System;
using System.Text;
using System.Web.UI;
using System.Web.UI.HtmlControls;
public class _BasePage : System.Web.UI.Page
    {
        /// code

    }

这个概念在 VB 中运行良好,但是我在这里做错了什么?

4

1 回答 1

1

这段代码在我的项目中编译=>i think that you have compilation problem in your page _BasePage class

using System;
using System.Text;
using System.Web.UI;
using System.Web.UI.HtmlControls;

namespace WebApplication1
{


    public class Test : System.Web.UI.Page
    {

    }

    public partial class _Default : Test
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}
于 2012-10-09T09:08:44.560 回答