App_Code class access confusion
am 16.01.2008 16:54:01 von rlm
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.
RE: App_Code class access confusion
am 16.01.2008 17:02:06 von pbromberg
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.