O'Reilly logo

CDO & MAPI Programming with Visual Basic: by Dave Grundgeiger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ASP Applications and Sessions

From the perspective of ASP, a web application is made up of all of the web pages contained in a virtual directory and its subdirectories. A session is a period of time during which a particular user is accessing pages in the application. A session begins when a user accesses a page in the application and ends when script on a page explicitly terminates the session or after a period of time has elapsed with no new page access. The default period of time is 20 minutes. The application is said to begin when the first session begins and to end when the last session ends.

Application and session startup and shutdown are ideal times to perform initialization and cleanup activities. For the application to be notified of these events, a file called global.asa must be in the application’s root folder, and in this file must be script to handle these events. Example 11-3 shows a skeleton global.asa file.

Example 11-3. Skeleton global.asa File

<script language="VBScript" runat="Server"> 

Sub Application_OnStart
   ' Application-wide initialization goes here.
End Sub

Sub Application_OnEnd
   ' Application-wide cleanup goes here.
End Sub

Sub Session_OnStart
   ' Per-session initialization goes here.
End Sub

Sub Session_OnEnd
   ' Per-session cleanup goes here.
End Sub

</script>

Note the use of the <SCRIPT> tag to identify the enclosed text as VBScript that is to be run by the server. VBScript is the default scripting language in IIS unless an administrator changes this ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required