473,804 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How are Application_Sta rt, etc., called?

How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't
implementing interface methods. What mechanism does the system use to
call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears later
on in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.
Aug 4 '06 #1
6 3067
They are events and they are wired up internally in ASP.NET
when the request is processed, session starts, or application
starts.

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Microsoft .NET Search Engine Scoring Analysis
How does your site rate?
http://www.topichound.com


"Harlan Messinger" <hm************ *******@comcast .netwrote in message
news:4j******** ****@individual .net...
How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't implementing
interface methods. What mechanism does the system use to call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears later on
in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.

Aug 4 '06 #2
Does it matterIs it not enough to know that they are fired?

"Harlan Messinger" wrote:
How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't
implementing interface methods. What mechanism does the system use to
call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears later
on in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.
Aug 4 '06 #3
Hi,

Could you avoid top posting? It makes the posts very difficult to read.
clickon wrote:
Does it matterIs it not enough to know that they are fired?
It does matter if you want to hook your own event handlers, for example.
It also matters if you want to have a deep understanding of how ASP.NET
works.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 4 '06 #4
clickon wrote:
"Harlan Messinger" wrote:
>How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't
implementing interface methods. What mechanism does the system use to
call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears later
on in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.
Does it matterIs it not enough to know that they are fired?
In case you're not aware of it, there are people in this world who are
curious about how things work. You should be thankful for that. Think
how the world would be otherwise.
Aug 4 '06 #5
Hi,

Harlan Messinger wrote:
How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't
implementing interface methods. What mechanism does the system use to
call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears later
on in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.
The Global.asax only defines the event handlers' body, not how they are
fired. The method Application_Sta rt is the equivalent of the Page_Load
in the line you wrote here above. The "hook" to the "Start" event (which
is the equivalent of the "Load" event in the line here above) is not
defined in Global.asax. The methods are called at various moments by the
different modules involved in processing the request.

There is an interesting post about this at
http://www.dotnet247.com/247referenc.../12/62243.aspx

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 4 '06 #6
Laurent Bugnion wrote:
Hi,

Harlan Messinger wrote:
>How do the Application methods like

protected void Application_Sta rt

get called? They aren't base class overrides and they aren't
implementing interface methods. What mechanism does the system use to
call them?

In a Web form, a similar handler like

private void Page_Load

gets called by virtue of the fact that the following line appears
later on in the page, in the OnInit override:

this.Load += new System.EventHan dler(this.Page_ Load);

But there isn't anything comparable in Global.asax.

The Global.asax only defines the event handlers' body, not how they are
fired. The method Application_Sta rt is the equivalent of the Page_Load
in the line you wrote here above. The "hook" to the "Start" event (which
is the equivalent of the "Load" event in the line here above) is not
defined in Global.asax.
Right, that's the part that I wasn't expecting.
The methods are called at various moments by the
different modules involved in processing the request.
I was just curious *how*, since there isn't an interface or base class
through which they could be doing that. It's occurring to me that it
must be through reflection, which seems sloppy and unnecessary, but
maybe the aspnet really handles the whole creation of the application
class object at that low level.
There is an interesting post about this at
http://www.dotnet247.com/247referenc.../12/62243.aspx
Thanks for that interesting overview.
Aug 4 '06 #7

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

Similar topics

4
7090
by: Halcyon Woodward | last post by:
I have an odd problem... We have a small development team (three coders) working on the same project (a C# web application). Each coder has a unique 'sandbox' site on a shared Windows 2003 where they can test the code they write. The majority of the code is written into a stand-alone class library shared via VSS, that is then referenced by each sandbox web (each of which is unique to each user). In the stand-alone class library, we...
4
11966
by: Max | last post by:
I've noticed some procedures don't run in the global.asax when you'd expect them to. I've rebuilt and set break points, but Application_Start just isn't firing today. Is there some configuration that prevents this from happening? I've never gotten Session_End to fire either. -M
1
4435
by: jonathan zheng | last post by:
I have built a web application and I put some code in the Application_Start, but what surprised me is that these codes are called more than one time. Actually when a new request is begin, these codes will be called Could anyone help on this? Thanks a lot I'm using Visual Studio .Net 2002 & Windows Professional 2000 & .Net Framework 1.1
0
2116
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two network cards in each machine. Machine keys are identical on both webservers. There is no anti-virus software installed. SQL Server database is storing session information as specified by Microsoft guidelines.
8
8521
by: bryan | last post by:
Is there any way I can get the application path (the one returned by Request.ApplicationPath) in the Application_Start method in Global.asax? Request is not valid there. On a related note, is there a way to get it from a static method in an aspx page, or in the class (static) constructor for an aspx page? Thanks, Bryan
4
2146
by: NoNickname | last post by:
Hi, I need to get a string from a COM component at application start. (It's a Long Story and I cannot change this fact.) In ASP.NET 1.1, I simply called this COM component in Global.asax.cs from Application_Start, stuck the string in the HttpApplication.Application object and life was good. However, I've noticed in ASP.NET 2.0 you are not given the opportunity to create a .cs codebehind file for the Global.asax when you go to ADD NEW...
12
1565
by: Thomas H. Lanier | last post by:
In ASP.NET is there a way to run some code when IIS first loads? The Application_Start event is called when the first resource (such as a page) in an ASP.NET application is requested. I need to run some code BEFORE any requests have been received. Thanks, Tommy
0
1006
by: Flemming | last post by:
I'm using Remoting which is applied inside application_start. In ASP.NET 2.0 application_start seems to be called when shifting domains in the same application - i.e. http://mydomain.dk http://www.mydomain.dk and when using remoting this may not happen, because the communication is still intact from the first call. The application variables is not available in the next calls to application_start.
0
1469
by: =?Utf-8?B?amNoYW4=?= | last post by:
Hi, I have a webservice application which was developed in vs2003. After I rewrite it in vs2005, the Application_Start behaves differently. The Application_Start keeps getting triggered when one of the WebMethod is called. I have exception handlings in this webmethod, but I don't see any error. Is there a way to debug to see why Application_Start gets triggered? Could we catch this unknown error in 2.0 webservice like asp.net...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10603
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.