CodeFiel and path

  • Thread starter Thread starter WT
  • Start date Start date
W

WT

Hello,

I have my code pages in App_Code\Subdir\ *aspx..cs folder,
the coresponding aspx are in \Subdir\*.aspx .

Compiler can't find the aspx when compiling the aspx.cs
and generates error for the controls from the aspx page.

This code is working perfectly in vs2003.

should I include a path in the CodeFile directive?
And how to do this ?
Same question for CodeFileBaseClass ?

Thanks for help.
CS
 
Hello,

The folder "App_Code" is a special folder in ASP.NET 2.0, you can not put
*.aspx.cs in this folder.

If you need to put some code/logic in "App_Code" , you can define a class
and put your logic in the class. The class will be put in the folder
"App_Code" and you can refer the class in your *.aspx.cs.

Luke
 
Luke,
Sorry but it is unclear.
May be you don't understand the problem (my fault).
My problem is migrating a large web site project containing many folders
with .aspx and related .aspx.cs files.
The migration wizard kept the folders in project root directory, keeping
only the .aspx files.
The .aspx.cs files have been automatically moved in the App_code folder,
copying the original folder hierachy under App_code.
And this does not compile because compiler can't create the relation
between the aspx and the codebehind.
CS
 
Understood,

My actual project was the result of beta 2 migration wizard, I will
rearrange the files to have the aspx.cs in same folder as aspx

Thanks
 
Still problem with the CodeFileBaseClass.
Could we create subfolders in in App_code
How to write the corresponding CodeFileBaseClass ?
Thanks again
 
CodeFileBaseClass specifies a path to a base class for a page. You can just
put your base class name here. For exmaple,

CodeFileBaseClass="MyPage"

The file "MyPage.cs" can be app_code or a sub folder of app_code.

Luke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top