Application state is basically a data repository that is
- stored in server memory, and
- globally available to all classes in an ASP.NET application.
Using application state is faster than storing and retrieving information in a database. And, unlike session state which is specific to a single user session, application state applies to all users and sessions. Therefore, application state is a useful place to store small amounts of often-used data that does not change from one user to another.
ASP.NET provides the following application-state support:
- An easy-to-use state facility that is compatible with earlier versions of ASP, works with all .NET-supported languages, and is consistent with other .NET Framework APIs.
- An application-state dictionary that is available to all request handlers invoked within an application. Unlike IIS and earlier versions of ASP, which restrict access to application state only to pages, all IHttpHandler and IHttpModule instances can store and retrieve global variables within the dictionary.
- A simple and intuitive synchronization mechanism that enables developers to easily coordinate concurrent access to global variables stored in the application state.
- Application-state values that are accessible only from code running within the context of the originating application. Other applications running on the system cannot access or modify the values.