Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Error About "Inherits" attribute, even though it's correct?

Tags:

asp.net

vb.net

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

like image 442
mickburkejnr Avatar asked Sep 23 '10 08:09

mickburkejnr


1 Answers

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.

like image 63
Protector one Avatar answered Sep 28 '22 02:09

Protector one