Monday, 4 October 2010

error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class

So after spending an hour digging around to find possible solution to this error and finding out all sort of weird suggestions, some reasonable and some not so reasonable (e.g. to simply use a deprecated attribute?!)

I found out that this (undoubtedly) very descriptive error could be down to another reason.. in my case I needed to extend the base class from which my pages and controls inherit to keep some information that I needed.

Well the key is in pages and controls - I only had one base class and obviously controls can't inherit from a class that inherits from page and vice versa. So if none of the other suggestions have helped .. check your base classes, what they inherit from and is it suitable for your page/controls.

No comments: