SessionStateModule.Start Event

Definition

The event that occurs when a session is created.

public event EventHandler Start;

Event Type

Examples

The following code example shows the contents of a Global.asax file with the Session_OnStart and Session_OnEnd events defined.

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

}

public void Session_OnEnd()
{

}
</script>

Remarks

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.

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also