Application State: Application state is a global storage mechanism accessible from all pages in the Web application and is useful for storing information that needs to be maintained between server round-trips and between pages.Application state is stored in the memory of the windows process which is processing user requests on the web server.
In ASP.Net, application state is an instance of HttpApplicationState class and it exposes key-value pairs to store information. Its instance is automatically created when a first request is made to web application by any user and same state object is being shared across all subsequent users. It is useful for storing information that needs to be maintained between server round trips and between requests for pages.
Once you add your application-specific information to application state, the server manages it. Following is an example of using application state in an application.
//Stroing information in application state
lock (this)
{
Application["NickName"] = "Merithub";
}
//Retrieving value from application state
lock (this)
{
string str = Application["NickName"].ToString();
}
Profile Properties: ASP.NET provides a feature called profile properties, which allows you to store user-specific data. This feature is similar to session state, except that the profile data is not lost when a user's session expires. The profile-properties feature uses an ASP.NET profile, which is stored in a persistent format and associated with an individual user. The ASP.NET profile allows you to easily manage user information without requiring you to create and maintain your own database.
In addition, the profile makes the user information available using a strongly typed API that you can access from anywhere in your application. You can store objects of any type in the profile. The ASP.NET profile feature provides a generic storage system that allows you to define and maintain almost any kind of data while still making the data available in a type-safe manner.
To use profile properties, you must configure a profile provider. ASP.NET includes a SqlProfileProvider class that allows you to store profile data in a SQL database, but you can also create your own profile provider class that stores profile data in a custom format and to a custom storage mechanism such as an XML file, or even to a web service.
Because data that is placed in profile properties is not stored in application memory, it is preserved through Internet Information Services (IIS) restarts and worker-process restarts without losing data. Additionally, profile properties can be persisted across multiple processes such as in a Web farm or a Web garden.
So, in the above illustrations, we understood the practical concepts of using different State Management techniques in ASP.Net techonology.