State in ASP.NET Applications

Preserving state across HTTP requests is a major problem in Web programming, and ASP.NET provides several facilities that are convenient to use. There are two main types of state to be preserved.

  • Application state is global information that is shared across all users of a Web application.

  • Session state is used to store data for a particular user across multiple requests to a Web application.

Shared Data Members

Shared data members of a class are shared across all instances of a class. Hence shared data members can be used to hold application state.

In our case study the class Global has a single shared member acmedat of the class Acme.

Thus the broker and custs objects within Acme will hold shared data that is the ...

Get Application Development Using Visual Basic® and .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.