6.1. Maintaining Information Needed by All Users of an Application
You want to make certain data available to all users of an application.
Place the code needed to find
load the data in the
Application_Start method of
global.asax and store it in the
In the code-behind class for
the .NET language of your choice to:
Create an event handler for the
Load the application data and store it in the
The code we’ve written to demonstrate this solution
is shown in Example 6-1 through Example 6-5. Example 6-1 and
Example 6-2 show the VB and C# code-behind files for
global.asax; this code reads data from a
database and places it in the
Figure 6-1 shows a simple form that
we’ve created to view the application state data.
Example 6-3 shows
.aspx file that produces the form. Examples
Example 6-4 and Example 6-5 show
the companion VB and C# code-behind files that demonstrate how to
access the application state data.
Figure 6-1. A view of some sample application state data
The purpose of the
is to store information once that can be simultaneously shared with all users of the application without having to access it repeatedly from a database or some other data store. A simple example is when you want to store and then share the number of times an application ...