After completing this tutorial, you will be able to
- Explain the importance of managing session state in a Web application
- Use the session state manager (the
- Configure session state
- Store session state on a state server
- Store session state in a database
ASP.NET session state support is extensive, reliable, and flexible-offering many advantages over the session state support available in classic ASP. For starters, ASP.NET session state is handled by the
Session object-an object dictionary that's automatically created with each new session (if you have session state enabled). The
Session object is easily accessible through the
HttpContext object, which you can reference at any point during the request. The process of associating user state with a particular user's session is handled automatically by ASP.NET. Whenever you want to access session state, you just grab it from the context (it's also mapped into a member variable living on the page). You may choose how ASP.NET tracks session state, and you may even tell ASP.NET where to store session state.
Let's begin with a look at how various pieces of state are managed by ASP.NET, and the gap filled by the session state manager.