Showing posts with label Application StateManagement. Show all posts
Showing posts with label Application StateManagement. Show all posts

Tuesday, August 23, 2011

Application State Management in asp.net

Application State is a Data Repository available to all Classes in an ASP.Net application state is Stored in memory of the server and is faster than storing and retrieving information in a database. Unlike session state, which is  specific to single user session, application state applies to all users and sessions. Therefore, application state is useful place to store small amounts of ofter-used data that does not change from one user to another.

Application State is stored in an instance of the HttpApplicationState Class.

Saving values in Application State
(C#)
Application["UserName"]="SimpleUserName";
Application["values"]="Some values";

Reading the values
(C#)
string username= Application["UserName"].Tostring();