ASP.NET错误关于"继承"属性,即使它是正确的? [英] ASP.NET Error About "Inherits" attribute, even though it's correct?

查看:274
本文介绍了ASP.NET错误关于"继承"属性,即使它是正确的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用ASP.NET网站目前我建立的那一刻有一个很奇怪的问题。

目前,我书面方式一个名为Dashboard.aspx页面的HTML和CSS。但是,当我走在浏览器中查看页面,一半的时间就抛出了这个错误:


  

ASPNET:请确保类
  在这个定义code文件匹配
  继承属性,并且它
  扩展正确的基类(例如
  Page或UserControl)。


我检查在.aspx页面上的继承属性,它Dashboard.aspx.vb文件的VB code的保持局部类相匹配。

当我刷新,它总是会想出这个错误。然后,一两分钟后,它会加载罚款没有问题。我对谷歌快看,我无法找到答案这个问题。

我也改变了部分类的名称(并在.aspx文件的内容占位符,以为可能导致冲突)并没有什么我做的似乎解决它。

任何人都可以摆脱任何光线就这是怎么回事?

谢谢,
迈克尔


解决方案

  

请确保在继承的财产
  aspx页面类定义匹配
  在cs文件。 [...]的继承
  属性和类必须有
  相同的命名空间和类名


(来源:继承asp.net 问题)

此外,确保没有其他页面(意外),试图从后面文件的同一code继承一个类。

Having a really strange issue at the moment with an ASP.NET site I'm currently building.

At the moment, I'm writting the HTML and CSS for a page called Dashboard.aspx. But when I go to view the page in a browser, half the time it throws up this error:

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).

I've checked the Inherits attribute on the .aspx page, and it matches the Partial Class held in the VB code of Dashboard.aspx.vb file.

When I refresh, it will always come up with this error. Then after a minute or two, it will load fine with no problems. I had a quick look on Google and I couldn't find an answer to this issue.

I have also changed the name of the partial class (and the content placeholder on the .aspx file, thinking that may have caused a conflict) and nothing I do seems to fix it.

Could anyone shed any light on what's going on?

Thanks, Michael

解决方案

Make sure the inherits property in the aspx page matches the class definition in the .cs file. […] the inherits property and the class must have the same namespace and classname

(From: Inherit problem in asp.net)

Additionally, make sure no other pages (accidentally) try to inherit a class from the same code behind file.

这篇关于ASP.NET错误关于"继承"属性,即使它是正确的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆