October 2010
Intermediate to advanced
1920 pages
73h 55m
English
Session EventsThere are two events related to Session state that you can handle in the Global.asax file: Session Start and Session End.
The Session Start event is raised whenever a new user session begins. You can handle this event to load user information from the database. For example, you can handle the Session Start event to load the user’s shopping cart.
The Session End event is raised when a session ends. A session comes to an end when it times out because of user inactivity or when it is explicitly ended with the Session.Abandon() method. You can handle the Session End event, for example, when you want to automatically save the user’s shopping cart to a database table.
The Global.asax file in Listing 28.12 demonstrates how you ...