473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Global.asax - Code Behind or Inline?

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

Jul 21 '05 #1
3 2837
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

Jul 21 '05 #2
With advantages / disadavantages exactly as with Code Behind / Inline for an
..aspx?

J
Jul 21 '05 #3
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" <jo****@surfeuNOSPAM.de>
wrote:
With advantages / disadavantages exactly as with Code Behind / Inline for an
.aspx?

J


Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jon Maz | last post by:
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...
22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
10
by: Ronnie | last post by:
I've created a simple web application using VS2005 Beta 2. Basically, I've added a Web Form and a Global.asax file. In my Global.asax, I create a method like: public static void TestGlobal()...
5
by: ad | last post by:
The Global.asax is code-inside with default. How to change Global.asax to code-behind?
4
by: John A Grandy | last post by:
I installed VS05 RC , created a new Web Site , but I do not see Global.asax , and I do not see Global.asax.cs in the App_Code dir ......
6
by: Mark Rae | last post by:
Hi, When you create a new web site in VS.NET 2005, it doesn't contain a Global.asax file by default and, when you add one manually, it creates a Global.asax file with in-line code e.g. <%@...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
8
by: Rob T | last post by:
When I was using VS2003, I was able to compile my asp.net project locally on my machine and copy it to the production server and it would run just fine. I've now converted to VS2005. The project...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.