Could not load type
-
I am simply trying to use the uploadfile control with no success. Also the remote server uses .net 1.0 If you cant help me with this error please tell me a different way of uploading files to a server using .net 1.0 The following is the error i keep getting: ------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'upload'. Source Error: Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="upload" %> Line 2: Line 3: Source File: d:\webs\omixad\upload.aspx Line: 1 --------------------------------------------------------- I have a simple upload.aspx file that has a fileupload object on it and actually uploads files to the server. ---------------------------------------------------------------------------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="upload" %> <script>
------------------------------------------------------------------------------------------- The code behind file is upload.aspx.cs ----------------------------------------------------------------------- using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class upload : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void UploadBtn_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { //FileUpload1.SaveAs(@"C:\temp\" + FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath(@"temp") + FileUpload1.FileName); Label1.Text = "File Uploaded: " + Server.MapPath(@"temp\") + FileUpload1.FileName; } else { Label1.Text = "No File Uploaded."; } } } --------------------------------------------------------------------- I have IIS running o
-
I am simply trying to use the uploadfile control with no success. Also the remote server uses .net 1.0 If you cant help me with this error please tell me a different way of uploading files to a server using .net 1.0 The following is the error i keep getting: ------------------------------------------------------- Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type 'upload'. Source Error: Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="upload" %> Line 2: Line 3: Source File: d:\webs\omixad\upload.aspx Line: 1 --------------------------------------------------------- I have a simple upload.aspx file that has a fileupload object on it and actually uploads files to the server. ---------------------------------------------------------------------------------------------- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="upload.aspx.cs" Inherits="upload" %> <script>
------------------------------------------------------------------------------------------- The code behind file is upload.aspx.cs ----------------------------------------------------------------------- using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class upload : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void UploadBtn_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { //FileUpload1.SaveAs(@"C:\temp\" + FileUpload1.FileName); FileUpload1.SaveAs(Server.MapPath(@"temp") + FileUpload1.FileName); Label1.Text = "File Uploaded: " + Server.MapPath(@"temp\") + FileUpload1.FileName; } else { Label1.Text = "No File Uploaded."; } } } --------------------------------------------------------------------- I have IIS running o
Hi there, Basically, you cannot use the new features in the ASP.NET 2.0 like the partial class, CodeFile attribute, FileUpload control .... to run with the ASP.NET 1.0. The reason it's working on you machine is simply that you use the right version 2.0 in your local environment. On the remote server, they use an older version of ASP.NET (1.0), so you need to go back with the options provided by the ASP.NET 1.0, there are a couple of things that you might need to change in order ton run on the remote machine: + Use the inline code instead of the code-behind with the partial class. + Use the HtmlInputFile[^] control instead of the FileUpload control. Below is a quick example for the changes:
<%@ Page Language="C#" %>
<html>
<head runat="server">
<title>Untitled Page</title>
<script runat="server">
protected void UploadBtn_Click(object sender, EventArgs e)
{
//TO DO: your code goes here to save the uploaded file.
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="File1" runat="server" type="file" />
<asp:Button ID="Button1" runat="server" Text="Upload"
On_Click="UploadBtn_Click"/>
</form>
</body>
</html>