Ämne: baseClass
Visa ett inlägg
Oläst 2006-05-18, 17:34 #1
cliffjesuss avatar
cliffjesus cliffjesus är inte uppkopplad
Nykomling
 
Reg.datum: May 2005
Inlägg: 28
cliffjesus cliffjesus är inte uppkopplad
Nykomling
cliffjesuss avatar
 
Reg.datum: May 2005
Inlägg: 28
Hej!

Jag sitter och försöker lära mig hur man skapar en "baseclass" som ärver från System.Web.UI.Page och som sedan alla sidor i projektet ärver av, men jag får det inte att fungera.

Först har jag min basklass som heter baseClass.vb och ligger i App_Code foldern
Kod:
Public Class baseClass
  Inherits System.Web.UI.Page

  Public Function hej()
    Return "hej!"
  End Function
End Class
Sedan min code-behind fil index.aspx.vb
Kod:
Public Class index
  Inherits baseClass


  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write(hej())
  End Sub
End Class
och till sist min aspx sida
Kod:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="index.aspx.vb" Inherits="index" %>

Jag får felmedelandet:

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



Någon som ser vad som är fel, det är inte världens mest kluriga problem antar jag, men jag är helt ställd och hittar inget vettigt på google.

Tack på förhand
cliffjesus är inte uppkopplad   Svara med citatSvara med citat