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

Discussion in 'ASP .Net' started by christian.Blackburn@Yahoo.com, Jun 14, 2006.

  1. Guest

    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 \
    ---------------------------------------------------------------------------------------------------------------------------------------
    , Jun 14, 2006
    #1
    1. Advertising

  2. 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
    Christian Blackburn, Jun 14, 2006
    #2
    1. Advertising

  3. kphani_prasad

    Joined:
    Nov 25, 2008
    Messages:
    4
    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
    kphani_prasad, Nov 25, 2008
    #3
  4. rconte

    Joined:
    Mar 24, 2009
    Messages:
    1
    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

    ------
    rconte, Mar 24, 2009
    #4
  5. Silvio443

    Joined:
    May 14, 2012
    Messages:
    1
    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?
    Silvio443, May 14, 2012
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Nitulescu
    Replies:
    0
    Views:
    347
    Alex Nitulescu
    Feb 22, 2005
  2. gec
    Replies:
    1
    Views:
    3,357
    samayamantri
    Jun 26, 2008
  3. murl
    Replies:
    0
    Views:
    602
  4. ton
    Replies:
    1
    Views:
    1,014
    Teemu Keiski
    Jun 24, 2007
  5. murl
    Replies:
    0
    Views:
    205
Loading...

Share This Page