V
Vicenç Masanas
I had a problem with some webforms and user controls. From time to time when
developing a new form or user control and testing I got the following error:
Could not load type 'xml.WebForm1'
I use to fight with this for a while and I allways endend up deleting the
form and starting again. Then it worked.
BUT TODAY I FOUND MY PROBLEM!
This error was showing becase on the <@page> or <@control> directive I had
an Inherits clause that pointed to a class which was slightly misspelled:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="xml.WebForm1"%>
and in the code behind file I had:
Public Class webForm1
Inherits System.Web.UI.Page
....
Notice the difference in the initial character of the className: just a
lowercase or uppercase difference. I've found the same problem with user
controls.
I've tried with different projects and I get the same result on all. It's
quite easy to reproduce:
create a new web project (defaults with WebForm1.aspx)
compile and run
---> it works
change the inherits clause on the <@ page> directive (just upper or lower
case, for example to Webform1
compile and run
----> it doesn't work
Why? Please can someone give a reason of this behaviour?
Vicenç
developing a new form or user control and testing I got the following error:
Could not load type 'xml.WebForm1'
I use to fight with this for a while and I allways endend up deleting the
form and starting again. Then it worked.
BUT TODAY I FOUND MY PROBLEM!
This error was showing becase on the <@page> or <@control> directive I had
an Inherits clause that pointed to a class which was slightly misspelled:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb"
Inherits="xml.WebForm1"%>
and in the code behind file I had:
Public Class webForm1
Inherits System.Web.UI.Page
....
Notice the difference in the initial character of the className: just a
lowercase or uppercase difference. I've found the same problem with user
controls.
I've tried with different projects and I get the same result on all. It's
quite easy to reproduce:
create a new web project (defaults with WebForm1.aspx)
compile and run
---> it works
change the inherits clause on the <@ page> directive (just upper or lower
case, for example to Webform1
compile and run
----> it doesn't work
Why? Please can someone give a reason of this behaviour?
Vicenç