In this post we are going to see how to work Application State in ASP.net. If we need to store the variables and object that we want to use throughout
the entire web site then Application State we can use. The Application object help
us to store and share data between all the pages in asp.net application easily.
Application state is closely similar to Session State but the difference between
is that session object store variables and objects for 1 particular for the duration
of that user's current visit, whereas application state store objects and variables
that are shared between users of application at the same time.
In ASP.NET application state store data using dictionaries or sets of name-value
pairs. We can set the value of application variable named SiteName like this.
C# Code
Application["SiteName"] = "Intranet Application";
With SiteName set, any pages in the application can read this string:
C# Code
string appName = (string)Application["SiteName"];
We can remove an object from application state using the Remove method, like
so:
C# Code
Application.Remove("SiteName");
If we have store multiple objects and variables in application and now we
want remove all this from application state then we can use RemoveAll method.
C# Code
It is important to be cautious when using application variables. Objects remain
in application state until we remove them using the Remove or RemoveAll methods,
or shut down the application in IIS. If we continue to save objects into the application
state without removing them, we can place a heavy demand on server resources and
dramatically decrease the performance of our applications.
Asp.Net Application State >>>>> Download Now
ReplyDelete>>>>> Download Full
Asp.Net Application State >>>>> Download LINK
>>>>> Download Now
Asp.Net Application State >>>>> Download Full
>>>>> Download LINK Eq