The event that occurs when a session is created.
Assembly: System.Web (in System.Web.dll)
The event is raised at the beginning of a request when a new session is started. A new session is started if a request is made that does not contain a session identifier, the session identifier is invalid, or the session associated with a session identifier has expired.
The Session_OnStart event is used to perform any initialization work for a session such as setting up default values for session variables.
You can specify a handler for the event by adding a public subroutine named Session_OnStart to the Global.asax file.
For more information about the Global.asax file, see Global.asax Syntax.
The following code example shows the contents of a Global.asax file with the Session_OnStart and Session_OnEnd events defined.
<script language="VB" runat="server"> Public Sub Session_OnStart() End Sub Public Sub Session_OnEnd() End Sub </script>
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.