Export (0) Print
Expand All

SessionStateModule.Start Event

The event that occurs when a session is created.

Namespace: System.Web.SessionState
Assembly: System.Web (in system.web.dll)

public event EventHandler Start
/** @event */
public void add_Start (EventHandler value)

/** @event */
public void remove_Start (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

The Start 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 Start 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>

<script language="C#" runat="server">
public void Session_OnStart()
{

}

public void Session_OnEnd()
{

}
</script>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft