*.cs files and ASP.NET 2.0 code beside model

M

Maxwell2006

Hi,



I am a bit confused about the inline source code compilation (or code beside
model) in ASP.NET 2.0



My understanding was that anything in App_Code folder will be compiled at
the 1st request time.



Today I created a Default.aspx file in VS2005 IDE. The IDE also created the
Default.aspx.cs as well. There is BIN folder and when I run the website,
there is no DLL.



Does that mean that any .CS code beside file will be compiled at the 1st
request time?



If that is true, why there is a special folder called App_Code? We can put
our class libraries within a .CS file at the website root, can we?



Any clarification would be appreciated,

Max
 
A

Andrea

Hello Maxwell2006,

Max, the App_Code folder has been designed to add all your additional class
that
doesn't belong to the code_behind infrastracture.

This mean that if you need to creare a public class to be used along all
your project
the only way that you have to share it (if it belong to the web project)
is to put
your cs file there.

Bye
Andrea
 
J

Juan T. Llibre

re:
if you need to create a public class to be used along all your project
the only way that you have to share it (if it belong to the web project) is to put your cs file
there

My personal preference is to compile any classes I write into an assembly,
and place the assembly in the /bin directory.

I would *never* place source code on any server.
 
S

Steven Cheng[MSFT]

Thanks for Andrea's input.

Hi Max,

Here are some other good articles decribing the ASP.NET 2.0 new compilation
model:

#Codebehind and Compilation in ASP.NET 2.0
http://msdn.microsoft.com/msdnmag/issues/06/01/ExtremeASPNET/

#One More On ASP.NET 2.0 Compilation
http://odetocode.com/Blogs/scott/archive/2005/06/30/1889.aspx

You can also find some good resource on the MSDN ASP.NET developer center:

http://msdn.microsoft.com/asp.net

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top