By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,967 Members | 2,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,967 IT Pros & Developers. It's quick & easy.

Problem with accessing class in APP_CODE folder

P: n/a
Hello,

I am trying to use APP_CODE folder for all my class files under VS 2005.
After adding APP_CODE in the solution explorer, I added a new web page by
right clicking project and selecting add new item. I expected the code
behind file (Default.aspx.cs) to automatically go under APP_CODE folder, but
it didnt. I tried to drag and drop the code behind file into the APP_CODE
folder. I also changed the page directive to the following:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="~/App_Code/Default.aspx.cs" Inherits="Default" %>

I also tried the follwing page directive

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

The problem that I am facing is the error that I get when I build the
solution. Following is the error

Error 1 The file '/Todelete/App_Code/Default.aspx.cs' is in the special
directory 'App_Code', which is not allowed.

I have searched for this error in the internet but didn't get a solution.
Can anybody please help me here. How can I make the code behind file to
reside inside my APP_CODE folder.

thanks
pradeep
Sep 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
you've created a codebehind file. (Default.aspx.cs)

these don't automatically go into the APP_Code folder, they reside in the same directory as the parent page.

the naming of the file should be something other than the parent page name then you can place it in the APP_code folder.
"pradeep_TP" <pr*******@discussions.microsoft.comwrote in message news:B6**********************************@microsof t.com...
Hello,

I am trying to use APP_CODE folder for all my class files under VS 2005.
After adding APP_CODE in the solution explorer, I added a new web page by
right clicking project and selecting add new item. I expected the code
behind file (Default.aspx.cs) to automatically go under APP_CODE folder, but
it didnt. I tried to drag and drop the code behind file into the APP_CODE
folder. I also changed the page directive to the following:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="~/App_Code/Default.aspx.cs" Inherits="Default" %>

I also tried the follwing page directive

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

The problem that I am facing is the error that I get when I build the
solution. Following is the error

Error 1 The file '/Todelete/App_Code/Default.aspx.cs' is in the special
directory 'App_Code', which is not allowed.

I have searched for this error in the internet but didn't get a solution.
Can anybody please help me here. How can I make the code behind file to
reside inside my APP_CODE folder.

thanks
pradeep


Sep 25 '06 #2

P: n/a
Hi,

pradeep_TP wrote:
Hello,

I am trying to use APP_CODE folder for all my class files under VS 2005.
After adding APP_CODE in the solution explorer, I added a new web page by
right clicking project and selecting add new item. I expected the code
behind file (Default.aspx.cs) to automatically go under APP_CODE folder, but
it didnt. I tried to drag and drop the code behind file into the APP_CODE
folder. I also changed the page directive to the following:

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="~/App_Code/Default.aspx.cs" Inherits="Default" %>

I also tried the follwing page directive

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

The problem that I am facing is the error that I get when I build the
solution. Following is the error

Error 1 The file '/Todelete/App_Code/Default.aspx.cs' is in the special
directory 'App_Code', which is not allowed.

I have searched for this error in the internet but didn't get a solution.
Can anybody please help me here. How can I make the code behind file to
reside inside my APP_CODE folder.

thanks
pradeep
I am also a maniac, welcome to the club :-) I prefer to have my source
code files placed somewhere else than the web application root, but...
it's not as easy in 2.0 as it was in 1.1

http://geekswithblogs.net/lbugnion/a.../12/91000.aspx

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.