Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could not load type ... (user control on web form)

Status
Not open for further replies.

IlseDC

Programmer
Mar 24, 2003
49
0
0
BE
I have a project (UserControls) with one user control (myControl) and one web form (myForm).
On the web form there is only the user control (myControl).

On my local machine the web form runs fine.

I copied the files to the production machine in the same structure as on my local machine.

I get the following error:

Parser error message: Could not load type 'ZKHNet.UserControls.MyControl'.

line 1:
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="MyControl.ascx.cs" Inherits="ZKHNet.UserControls.MyControl" TargetSchema="


The file structure on the production server is the same as on my local PC.
C:\inetpub\C:\inetpub\C:\inetpub\C:\inetpub\
In IIS I made an application of "UserControls".

I also made some web services and these are running fine on the production machine.
I did the test with
Does anyone know what is wrong with the user control and the web form?
 
Have you added the "Register" tag to the top of your aspx page? Actually, you probably have if it works fine on your local machine but it's worth checking as a starting point.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Yes I have the "Register" tag in the aspx page.

<%@ Register TagPrefix="uc1" TagName="myControl" Src="myControl.ascx" %>


 
IlseDC,

All I can tell u with 95%-98% certainty is that the version of UserControls.dll in the bin directory on the prod machine isn't the latest version, or at least isn't the version that contains the class definition for myControl.

At least the CLR is able to find the DLL, otherwise you'd probably get parser errors in global.asax.

As to reasons why that dll wouldn't contain the class definition, I wouldn't be able to say exactly, except to say that it's usually something obvious that you;ve missed...probably cos u've gone over it hundreds of time and its numbed u out.

For example, in my case, I copied an old web application that was working on some other machine onto a new workstation that has VS.NET. I verified that the old code worked by loading the web forms. I added some new ASCX and ASPX. It compiled all OK. I loaded the web form, but got the same parser error as u. Deleted the DLL in the \bin directory and recompiled. This time got parser error to do with the global.asx. Sure enough, VS.NET was outputing to \bin\debug...not \bin. Changed vs.NET settings and recompiled. Worked

That was pretty long winded, also make sure that your capitalisation is consistent.C# is case sensitive!!

Anyways, my example should highlight that u need to go back to basics and make triple sure that u've got the right settings and version of files.

G'luck.
 
Solution:
MyControl used some external DLL's that were not copied to the production server.
So MyControl could not run and could not been loaded.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top