Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

error message "Could not load type" for a .NET 1.1 asp project converted to VS 2008 .NET 3.5

Posted on 2008-09-30
3
Medium Priority
?
888 Views
Last Modified: 2013-12-17
I am working with some code that was developed in the year 2004. So I suppose that it is .NET 1.1 code.  
I created a visual studio 2008 project but am getting an error when I try and build the code. . One obvious problem appears to be that the attribute "CodeFile" is being used. Please check out the code I am providing and tell me if you can spot the problem which is creating the bug. Here is the error message I am getting:
Error      13 Could not load type 'CaptchaImage.JpegImage'.      C:\America\JpegImage.aspx      

Here is the .aspx code:
<%@ Page language="c#" Codebehind="JpegImage.aspx.cs" AutoEventWireup="false" Inherits="CaptchaImage.JpegImage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>JpegImage</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form id="JpegImage" method="post" runat="server">
</form>
</body>
</html>
----------------------------Below is the C# code--------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
 
namespace CaptchaImage
{
 public class JpegImage : System.Web.UI.Page
 {
	private void Page_Load(object sender, System.EventArgs e)
		{
// Create a CAPTCHA image using the text stored in the Session object.
CaptchaImage ci = new CaptchaImage(this.Session["CaptchaImageText"].ToString(), 200, 50, "Century Schoolbook");
// Change the response headers to output a JPEG image.
	this.Response.Clear();
	this.Response.ContentType = "image/jpeg";
 
	// Write the image to the response stream in JPEG format.
	ci.Image.Save(this.Response.OutputStream, ImageFormat.Jpeg);
 
	// Dispose of the CAPTCHA image object.
	ci.Dispose();
		}
 
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
		
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
	private void InitializeComponent()
	{    
	this.Load += new System.EventHandler(this.Page_Load);
	}
		#endregion
	}
}

Open in new window

0
Comment
Question by:brgdotnet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 520 total points
ID: 22607026
All you have to do is change the line 1 in the aspx files: replace the keyword Codebehind="..." with Codefile="...", also do the following:

1. Rename the namespace CaptchaImage for anything else, because there is a class that hass the same name CaptchaImage. You must change namespace also in the aspx files (line 1) from Inherits="CaptchaImage._Default" to Inherits="TheNewNamespace._Default"

2. Change the declaration of classes from public class ClassName to public partial class ClassName, ie: public partial class JpegImage

3. Move class CaptchaImage to App_code folder.

4. Rename the form in JpegImage.aspx to form1 or anything else.

5. Remove the META tags in aspx files.
0
 
LVL 2

Author Closing Comment

by:brgdotnet
ID: 31501602
Thank you. Great job!
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22643424
your welcome
0

Featured Post

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question