The Session Object

Before you look at the Session object, you need to understand the concept of scope, in which data is either made available to all pages of an ASP.NET application or localized to just certain pages. The Application object example earlier in this chapter (in the section named “Using Application Object Collections: Contents and StaticObjects”) demonstrates this concept. You can use the Session object to store both simple data values and—as you’ll see later in this book—references to objects such as database connections. These become global to the whole application, and are available to any of its pages.

However, when you have data that needs to be shared between different pages, but not necessarily between different clients, ...

Get Special Edition Using® Microsoft® ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.