ASP.NET pages work locally, why not on a website?

Associate
Joined
18 Oct 2002
Posts
972
Location
Derby
I am building a simple website that does a little bit of database select/edit/delete etc and I am working in VS 2005. The way I have set up the project in the development environment is:

index.aspx (this is the presentation etc...)

index.aspx.cs (this is the code behind stuff and basically calls methods from a classfile)

Class1.cs (this is my class file)

What is troubling me is, inside the development environment it works fine, but when I upload the site to my webspace and try to access the .aspx page I get the error:


Code:
Compiler Error Message: CS0246: The type or namespace name 'Class1' could not be found (missing a using directive or an assembly reference?)



I have set up an older computer as a local webserver and when I upload the files and test it out on that it works. This has been really puzzling me so I have made a simple "Hello World" type page to see if any of you guys can spot any obvious mistakes?

Here is my class file

Code:
public class Class1
{
	public Class1()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public string Message()
    {
        string Confirmation = "Hello There!";
        return Confirmation;
    }
}

and here is my index.aspx.cs file which creates an instance of that class and assigns a label to the Message() method.

Code:
public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GetTest();

    }

    public void GetTest()
    {
        Class1 TheClass = new Class1();
        Test.Text = TheClass.Message();
    }
}

Finally I have the index.aspx which the user sees, this is just a label but I
thought I would add the top line to be sure I have not done anything wrong:

Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>

Does anyone see anything obvious which would mean it doesnt work on my webspace? I have doubled checked and the website is running .NET 2.0. As far as I can see if it works locally and on a intranet, why not on a webhost's server?
 
The website may have The 2.0 framework installed, but the directory your code is in might not be set up to be an ASP 2.0 application. The lack of ability to compile/execute code in App_Code, suggests to me that the application has been set up as an ASP 1.1 app.

Get your server admin to check it out.
 
Back
Top Bottom