473,396 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

App_Code class access confusion

Steps to reproduce:
1. Create new web app. I am in v3.5 and vs2008
2. Create App_Code folder
3. Add Class A with public static int B;
4. Go to default.aspx.cs Page_Load and the compiler says that Class A does
not exist in the current context.

Why? And how do I access these classes in App_Code?

By default it creates the namespace for the class as
WebApplication1.App_Code, but htis doesn't seem to matter. I change the
namespace or remove it, nothing works.

I have another starter kit that has App_Code classes which are recognized
fine, but I don't know why.
Jan 16 '08 #1
1 5983
I believe the APP_CODE folder is only used in the Web Site project model,
not in the Web Application Project. Just add the class to the project at the
same level as the aspx pages, or compile it to a separate class library app
and set a reference to it.
-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
MetaFinder: http://www.blogmetafinder.com
"rlm" wrote:
Steps to reproduce:
1. Create new web app. I am in v3.5 and vs2008
2. Create App_Code folder
3. Add Class A with public static int B;
4. Go to default.aspx.cs Page_Load and the compiler says that Class A does
not exist in the current context.

Why? And how do I access these classes in App_Code?

By default it creates the namespace for the class as
WebApplication1.App_Code, but htis doesn't seem to matter. I change the
namespace or remove it, nothing works.

I have another starter kit that has App_Code classes which are recognized
fine, but I don't know why.
Jan 16 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Steve Franks | last post by:
I'm using VS.NET 2005 Beta 2. I have a helper C# class I wrote that I placed in my /App_Code directory. Everything runs fine locally. However when I use the "Copy Web" function to upload the site...
5
by: Jay Douglas | last post by:
I have a set of pages that inherit from a base class in the App_Code folder. The class looks something like: public class MyBaseClass : System.Web.UI.Page In various stages of the life cycle I...
0
by: dm1608 | last post by:
Hello -- I'm trying to rewrite a few simple ASP pages that I have to use ASP.NET 2.0. One of the nice things I see that I can do now is separate my Business Logic layer and Data Access Layer...
7
by: hummh | last post by:
Hello out there, I´m making my first steps with ASP.NET 2.0 and have he following problem: I´ve implemented a Web User Control that sits in the root of my ASP.NET Website. I want to use the...
2
by: dawg1998 | last post by:
I am trying to access a label located in a MasterPage from a class located in my application's App_Code folder. The problem seems to be that the class cannot communicate with the MasterPage due to...
2
by: walter | last post by:
Hi, when I add a new page in my asp.net 2 project and put some controls there, everything works fine until I move the code behind into App_Code folder.--When I compile , it tells me that control...
9
by: rn5a | last post by:
Is putting a VB class file in the special directory named App_Code the same as relocating the VB class file from the App_Code directory to another directory & then using the VBC tool, compiling the...
4
by: dan_vee | last post by:
Hello everyone, I've been out of the .NET loop for a little while. This question might seem trivial for many of you. But I 'm a bit stumped. I recently started to work with VS 2005 ASP.NET 2.0....
5
by: Randy | last post by:
I've converted a VS 2003 project to VS 2005. I have one utility class that it put in the APP_CODE directory. When I try and compile I'm getting this error... Error 1 The type or namespace name...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.