about codebehind..

G

Guest

hi guys,

when we compiling the asp.net project, all codebehind pages gives you one
dll. suppose if i write the code in .aspx forms itself then is it create a
dll ?

if i write the code in aspx files then wht is going on when running the
project?
 
P

Patrice

When an APSX page is hit, ASP.NET generates source code for the page and
compile it into a DLL. Compiling the whole site in a single DLL is a VS.NET
limitation. You can compile a web site into multiple DLLs using the command
line compiler...

AFAIK VS 2005 will be more flexible will both allow compiling the site into
multiple DLLs or in a single DLL (including ASPX pages, images resources
etc...)
 
K

Kevin Spencer

The Template file is not compiled to a DLL, although it is a class
definition. It is compiled at run-time.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
J

JIMCO Software

nagesh said:
hi guys,

when we compiling the asp.net project, all codebehind pages gives you
one dll. suppose if i write the code in .aspx forms itself then is it
create a dll ?

When the application is hit for the first time, what happens depends on
several factors.

First Scenario : Batch Compilation (assuming using VS.NET with an assembly
in /bin):
If you have debug set to false in your web.config (which you ALWAYS should
in production), when the site first gets hit, you'll get a dynamic assembly
compiled for your global.asax that will contain the type ASP.global_asax.
You will then get one dynamic assembly compiled for the folder in which the
file you requested exists. For example, if you request default.aspx, you
will get one dll that contains each type in that folder and they will have a
namespace of _ASP. The "_" indicates that they have been batch compiled.

As each folder gets hit, a new dynamic assembly is compiled for that folder
and that assembly will have an _ASP namespace. If you were to dump all the
object on the heap at this point, you'd see all of these objects.

Second Scenario: Non-Batch Compilation
If debug is true in your web.config, OR if you are using the Src attribute
instead of CodeBehind, OR if you are using inline ASP.NET code (such as you
are suggesting), batching is disabled. (You can also explicitly disable
batching via your configuration file.) That means that you get one assembly
(one dll) for each page and they will all have an ASP namespace. I mention
the namespace only because it's an easy way to determine if batching is
enabled when you are looking at these types in a debugger. There are other
ways as well if you are intricately familiar with the inner structures of
ASP.NET.

Having batch compile disabled is a bad thing. The assemblies that get
created are not large, but they are loaded into no particular address space.
That means that they get scattered all over system memory. This greatly
increases the likelihood of an OutOfMemoryException occurring because it
causes fragmentation.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003
 

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,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top