Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Active Server Pages (ASP)
Expertise: Beginner
Dec 16, 1999

Understanding Session_OnStart and Application_OnStart

Question:

I am confused regarding the Application_OnStart and Session_OnStart events in the global.asa file. What I feel is that the application_onstart event is triggered the very first time the application is used and the session_onstart event is triggered every time a user is logged onto the application. Can you please clarify?

Answer:

As a loose analogy, the application referred here is your Web site itself, while the session is one browser's visit. Once you stop and start your Web site, the first visitor to the Web site fires the Application_OnStart event. The first time a user hits your Web site, whether he is the first visitor or not, the Session_OnStart fires.

So, for your very first visitor after you start your Web site, both the Application_OnStart and the Session_OnStart events fire. For every other visitor after that, the Session_OnStart will fire, and not the Application_OnStart. If you stop and start your Web site (services), then the cycle will be repeated.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date