BlackBear
BlackBear

Reputation: 22989

My ASP.NET site doesn't find files located in different folders

My website has many pages which operate on some data in a database. Since many procedures are the same, I have put all of these "general" functions inside a (public partial) static class and saved it in the App_Code folder as suggested by Visual Studio:

Root
 |
 +-- App_Code
 |       |
 |       +-- GeneralStuff.cs
 |       |
 |       +-- DataStructure.cs
 |
 +-- Default.aspx
 |
 +-- Default.aspx.cs
 |
 +-- etc

The problem is that whenever I try to use something defined inside my GeneralStuff class the page doesn't compile because it can't find that class:

Compiler Error Message: CS0103: The name 'GeneralStuff' does not exist in the current context

I can't also use the files that are saved in the App_Data folder. Note that everything works fine when running from Visual Studio.

Additional details: Here's the version I'm using:
- Microsoft .NET Framework Version:2.0.50727.3625;
- ASP.NET Version:2.0.50727.3634;

Any hints?

Cheers

Upvotes: 0

Views: 287

Answers (1)

Keith
Keith

Reputation: 5381

Is your class declaration decorated by a namespace? If so, you will need to include a reference to that namespace anywhere you want to use it (use the using Namespace.Sub syntax)

Upvotes: 2

Related Questions