June 2002
Intermediate to advanced
816 pages
28h 12m
English
Start
Sub Application_OnStart( ) ‘Event handler logic End Sub
Fired
when
the Application is created. The event handler for this event should
be defined in the global.asax application file.
None
The example writes an entry to both the Application Event log and the IIS log for the application to indicate that the Start event has fired:
<Script language="VB" runat="server">
Sub Application_OnStart( )
Dim EventLog1 As New System.Diagnostics.EventLog ("Application", _
".", "mySource")
EventLog1.WriteEntry("Application_OnStart fired!")
Context.Response.AppendToLog("Application_OnStart fired!")
End Sub
</script>There is one issue with the code above. Security in the released version of the .NET framework has been tightened, so writing to the event log will not work by default in an ASP.NET application.
The Start event is useful for performing initialization tasks when the application is initialized. You can initialize Application variables that are mostly static.
Read now
Unlock full access