what is application state in asp.net
Application state in asp.net is a server side state management technique.
The date stored in application state is common for all users of that particular ASP.NET application and can be accessed anywhere in the application.
It is also called application level state management. ASP.NET provides application state via the HttpApplicationState class as a method of storing global application-specific information that is visible to the entire application.
Application-state variables are, in effect, global variables for an ASP.NET application.
We can store our application-specific values in application state, which is then managed by the server.
Data that is shared by multiple sessions and does not change often is the ideal type of data to insert into application-state variables.
Application state is a data repository available to all classes in an ASP.NET application. Application state is stored in memory on the server and is faster than storing and retrieving information in a database. 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.
Application State is used to store information which is shared among users of the ASP.Net web application. Application state is stored in the memory of the windows process which is processing user requests on the web server. Application state is useful in storing a small amount of often-used data. If application state is used for such data instead of frequent trips to the database, then it increases the response time/performance of the web application.
If the information that you want to be accessed or stored globally throughout the application, even if multiple users access the site or application at the same time, then you can use an Application Object for such purposes.
“A global storage mechanism that is accessible from all pages in the Web application. Application state is stored in the Application key/value dictionary. This information will also be available to all the users of the website.”
Advantages of using application state in asp.net :-
Simple implementation: Application state is easy to use, familiar to ASP developers, and consistent with other .NET Framework classes.
Application scope: Because application state is accessible to all pages in an application, storing information in application state can mean keeping only a single copy of the information (for instance, as opposed to keeping copies of information in session state or in individual pages).
Disadvantages of using application state in asp.net :-
Application scope: The scope of application state can also be a disadvantage. Variables stored in application state are global only to the particular process the application is running in, and each application process can have different values. Therefore, you cannot rely on application state to store unique values or update global counters in Web-garden and Web-farm server configurations.
Limited durability of data: Because global data that is stored in application state is volatile, it will be lost if the Web server process containing it is destroyed, such as from a server crash, upgrade, or shutdown.
Resource requirements: Application state requires server memory, which can affect the performance of the server as well as the scalability of the application.