Make sure that the class defined in this code file matches the 'inherits' attribute

  • Thread starter christian.Blackburn
  • Start date
C

christian.Blackburn

Hi Gang,

On my development system I am not getting this error, but it does
happen when I upload it to my ISP. Can someone tell me why this is
happening? I don't have any user-defined controls which seems to be
the primary cause. My code is ASP 2.0/VB.

Thanks a bunch,
Christian Blackburn
---------------------------------------------------------------------------------------------------------------------------------------
Server Error in '/' Application.
--------------------------------------------------------------------------------

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 6:
Line 7:
Line 8: Partial Class LoginH
Line 9: Inherits System.Web.UI.Page
Line 10:


Source File: E:\web\motoadvisor\htdocs\Login.aspx.vb Line: 8 \
---------------------------------------------------------------------------------------------------------------------------------------
 
C

Christian Blackburn

Hi Gang,

I guess this is a pretty small group, because no-one answered my
question. However, I did figure it out and would very much like the
next guy to not suffer the same problems I did. I found so much
worthless unrelated Q+A on the web. It was an ASP.net 1.1 \bin\ folder
on the remote website that was causing the problems. Once I deleted
that folder the issue went away entirely.

Thanks,
Christian Blackburn
 
Joined
Nov 25, 2008
Messages
4
Reaction score
0
Could be Repeated referred Codebehind classes...

Thanks Christian,
We have come across this problem, we observed that same class file name is used in different codebehind classes/pages.

when we removed those conflicts, problem resolved.

hope it helps,
--Phani, India
Christian Blackburn said:
Hi Gang,

I guess this is a pretty small group, because no-one answered my
question. However, I did figure it out and would very much like the
next guy to not suffer the same problems I did. I found so much
worthless unrelated Q+A on the web. It was an ASP.net 1.1 \bin\ folder
on the remote website that was causing the problems. Once I deleted
that folder the issue went away entirely.

Thanks,
Christian Blackburn
 
Joined
Mar 24, 2009
Messages
1
Reaction score
0
I had a master file, .master + .master.vb like this: (file name next first line inside)

Master 1 -----------------
wFormularios.master
<%@ Master Language="VB" CodeFile="wFormularios.master.vb" Inherits="formularios" %>

wFormularios.master.vb
Partial Class formularios



Needed another, similar master, so I made a copy and cjanged the external name; ended with 2 master files, like this.

Master 1 -----------------
wFormularioPesquisa.master
<%@ Master Language="VB" CodeFile="wFormularioPesquisa.master.vb" Inherits="formularios" %>

wFormularioPesquisa.master.vb
Partial Class formularios

Master 2 -----------------
wFormularioPesquisa.master
<%@ Master Language="VB" CodeFile="wFormularioPesquisa.master.vb" Inherits="formularios" %>

wFormularioPesquisa.master.vb
Partial Class formularios



Note the same partial class name. That resulted in the error.
Changed the class name by adding a "2" in the second master file, that solved the problem. Like this:

Master 2 -----------------
wFormularioPesquisa.master
<%@ Master Language="VB" CodeFile="wFormularioPesquisa.master.vb" Inherits="formularios2" %>

wFormularioPesquisa.master.vb
Partial Class formularios2

------
 
Joined
May 14, 2012
Messages
1
Reaction score
0
In my case, running a site on .Net 2.0.57***, I have a problem like this error message. The site has run well and uses two IIS web servers with load balancer. But since I updated on of the two .vb scripts in the folder, the same code started to give this error. I tried all the possible solutions (originally it has the right CodeFile and Inherits attribute values in Page declaration and they are unique). No change from CodeFile to CodeBehind helped. The same error appeared also in the other script in same folder. For example, I have /Developments/Details.aspx

<%@ Page Title="" Language="VB" MasterPageFile="~/Master.master" AutoEventWireup="true" CodeFile="Details.aspx.vb" Inherits="Developments_Details" %>


And the Details.aspx.vb code is:
Imports Smart
Imports System.Data
Imports System.Data.SqlClient

Partial Public Class Developments_Details
Inherits SmartPage

Where SmartPage is the a class in folder App_Code. Other pages that inherit it (and it inherits as base class System.Web.UI.Page) work fine. But after

change of the script, even returning the original one, I constantly get the same error "500: ....\developments\Details.aspx.vb(1): error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (". What you would advise me to do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top