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

Last post 11-12-2009 3:44 PM by InNeedOfAssistance. 5 replies.

Sort Posts:

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

    11-05-2009, 5:09 PM

    For the life of me I can't figure out what is causing this error. I have copied and pasted the namespace and the class name into inherits on the .aspx page. I had this compiled and working but now since I switched my development PC to Visual Studio 2008 on a Windows 7 OS, I can no longer compile. I don't have any old code with section12.PicturesAjax in it. Hopefully you'll see what I'm missing and clue me in. Help!

    PicturesAjax.aspx code:

    <%@ page language="c#" autoeventwireup="true" inherits="section12.PicturesAjax" CodeFile="PicturesAjax.aspx.cs" Codebehind="PicturesAjax.aspx.cs"  %>
    <html>
    <%=pageContents%>
    </html>

    PicturesAjax.aspx.cs code:

    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    namespace section12
    {
        partial class PicturesAjax : System.Web.UI.Page
        {
          public string pageContents = "";

          protected void Page_Load(object sender, EventArgs e)
          {
            // This code opens an .asp picture page and strips out the code from body beginning to end body
            .
            .
            .
            pageContents =
    code stripped from .asp picture page
          }
        }
    }

       



  • Re: 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).

    11-05-2009, 5:13 PM
    • All-Star
      87,118 point All-Star
    • limno
    • Member since 06-10-2005, 7:50 PM
    • Iowa, USA
    • Posts 4,949
    • Moderator
      TrustedFriends-MVPs

    <%@ page language="c#" autoeventwireup="true" inherits="section12.PicturesAjax" CodeFile="PicturesAjax.aspx.cs"  %> 

    Limno

    Format your SQL query with instant sql formatter:
    http://www.dpriver.com/pp/sqlformat.htm
  • Re: 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).

    11-05-2009, 5:53 PM

    Thanks for the quick response.

    I deleted Codebehind="PicturesAjax.aspx.cs" from the <%@page ...

    but unfortunately I still get the same error. Any other suggestions?

  • Re: 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).

    11-06-2009, 6:12 PM

    Now I'm even more baffled. I excluded the aspx/aspx.cs pages that were causing the error. I added a new aspx page with a totally different name and used the generated class. I referenced this generated new page and the first error I received was on using System.Linq; . My web is targeting .net 3.5. per the suggestion on the MS page I found, it suggested adding System.Core as a reference to the solution. Although it was already listed as a reference, I double clicked on it. The System.Linq error went away and now when I compile I'm back to the original error Make sure that the class defined in this code file matches... on this new generated page. I haven't added any code to the generated code. I'm wondering if I could be missing another reference to the project similiar to the System.Core problem. Any suggestions?

  • Re: 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).

    11-10-2009, 8:23 PM

    I don't know if this will help with diagnosing this problem but the pc that I'm having problems compiling on was originally Vista (although I never used it as such). It is also a Toshiba Satellite laptop. I did not reformat this laptop before installing Windows 7 on top of the Vista OS. I just updated this laptop with all of the most recent Windows updates and relevant optional updates today and tried to compile but still ended up with the same error.

    I have another pc that was reformatted before installing Windows 7. I'm in the process of moving all of my code to this pc. I'll let you know how the compile goes there.

    Anyone else having any of these problems?

    Would it be better to move this post to a different forum?


    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

    Diagnosing

  • Re: 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).

    11-12-2009, 3:44 PM

    Yesterday I compiled this web on a Windows 7 PC. After compiling the web, I copied it back on the the Vista/Windows 7 PC. The application then compiled. Today I tried to compile a subweb on the Vista/Windows 7 PC and got this error:

    Could not load type 'IsapiModule'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Could not load type 'IsapiModule'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Could not load type 'IsapiModule'.]
    System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +11210608
    System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +23
    System.Web.Configuration.HandlerFactoryCache..ctor(String type) +25
    System.Web.HttpApplication.GetFactory(String type) +91
    System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +338
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263


    Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927


    I then copied the subweb onto the Windows 7 PC and compiled it without a problem. I copied the subweb back to the Vista/Windows 7 PC and still had the 'could not load the IsapiModule' error. I did Google this error but couldn't find a solution. Any suggestions?

Page 1 of 1 (6 items)