Global.asax - Code Behind or Inline?

Discussion in 'ASP .Net' started by Jon Maz, Oct 13, 2004.

  1. Jon Maz

    Jon Maz Guest

    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
     
    Jon Maz, Oct 13, 2004
    #1
    1. Advertising

  2. hi ,
    yes you are right global.asax can be both inline and codebehind .

    regards
    ansil

    "Jon Maz" wrote:

    > 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
    >
    >
    >
    >
     
    =?Utf-8?B?QW5zaWwgTUNBRA==?=, Oct 13, 2004
    #2
    1. Advertising

  3. Jon Maz

    Jon Maz Guest

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

    J
     
    Jon Maz, Oct 13, 2004
    #3
  4. Jon Maz

    Scott Allen Guest

    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.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/

    On Wed, 13 Oct 2004 14:17:00 +0100, "Jon Maz" <>
    wrote:

    >With advantages / disadavantages exactly as with Code Behind / Inline for an
    >.aspx?
    >
    >J
    >
     
    Scott Allen, Oct 13, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YmNoYXJsZXM=?=

    global.asax and global.asax.cs

    =?Utf-8?B?YmNoYXJsZXM=?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    913
    =?Utf-8?B?YmNoYXJsZXM=?=
    Oct 5, 2004
  2. ad
    Replies:
    5
    Views:
    11,239
    Scott Allen
    Sep 11, 2005
  3. =?Utf-8?B?Tm9OaWNrbmFtZQ==?=

    ASP.NET 2/Global.asax/code-behind/Application_Start

    =?Utf-8?B?Tm9OaWNrbmFtZQ==?=, Nov 9, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    6,369
    Juan T. Llibre
    Nov 9, 2005
  4. Mark Rae

    Global.asax / Global.asax.cs in v2

    Mark Rae, May 23, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    3,209
    Mark Rae
    May 23, 2006
  5. Hardy Wang
    Replies:
    4
    Views:
    6,952
    Steven Cheng[MSFT]
    Sep 8, 2006
Loading...

Share This Page