Name
Start
Synopsis
Sub Session_OnStart( ) ‘Event handler logic End Sub
Fired
when the session is created. The event
handler for this event should be defined in the
global.asax
application file.
Parameters
None
Example
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 Session_OnStart( ) Dim EventLog1 As New System.Diagnostics.EventLog ("Application", _ ".", "mySource") EventLog1.WriteEntry("Session_OnStart fired!") Context.Response.AppendToLog("Session_OnStart fired!") End Sub </script>
Notes
The Start event is useful for performing initialization tasks for a new session. One limitation of classic ASP, the inability to access the Server.MapPath method in the Session_OnStart event handler, is eliminated in ASP.NET. You can now successfully call Server.MapPath from within this event handler.
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.