Global.asax - Code Behind or Inline?

J

Jon Maz

Hi All,

I've just noticed that there seem to be two ways of setting up a global.asax
file.

At http://www.csharphelp.com/archives/archive206.html the global.asax
example has Application_Start etc within <script runat="server"> ...
</script> tags, whereas VS.Net creates a global.asax.cs file that is
presumably pre-compiled like a .aspx.cs file.

Am I correct in assuming that global.asax works just like a .aspx, ie there
is a Code Behind model and an Inline model, and the programmer has an open
choice between the two, depending on a trade-off between speed (compiled
Code Behind) versus the maintainability of not having to recompile after
changes (Inline)?

And presumably, as with inline .aspx pages, does an inline global.asax get
compiled when the first page of the application is hit?

TIA,

JON
 
J

Jon Maz

With advantages / disadavantages exactly as with Code Behind / Inline for an
..aspx?

J
 
S

Scott Allen

Yes, same advantages disadvantages. The runtime will compile
global.asax with inline code when the application spins up. At that
point, there really is no runtime performance diff of the code in
global.asax versus code compiled in the code behind.
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top