Hi,
I Dont know about Application and Session State management.
Can anyone explain me with simple example?
Answer Posted / chandra prakash
Application state allows you to store global objects that can be accessed by any client. Application
state is based on the System.Web.HttpApplicationState class, which is provided in all web
pages through the built-in Application object.
Application state is similar to session state but the difference is that session state is user specific. It supports the same type of objects, retains
information on the server, and uses the same dictionary-based syntax. A common example
with application state is a global counter that tracks how many times an operation has been
performed by all the web application’s clients.
For example, you could create a Global.asax event handler that tracks how many sessions
have been created or how many requests have been received into the application. Or you can
use similar logic in the Page.Load event handler to track how many times a given page has
been requested by various clients. Here’s an example of the latter:
protected void Page_Load(Object sender, EventArgs e)
{
// Retrieve the current counter value.
int count = 0;
if (Application["HitCounterForOrderPage"] != null)
{
count = (int)Application["HitCounterForOrderPage"];
}
// Increment the counter.
count++;
// Store the current counter value.
Application["HitCounterForOrderPage"] = count;
lblCounter.Text = count.ToString();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Which is faster viewdata or viewbag?
In a webservice, need to display 10 rows from a table. Which is the best choice among datareader or dataset?
How to retrieve user name in case of Window Authentication?
How to prevent client side validation from the ASP.NET validation controls?
Can we have multiple worker process in an ASP.NET application? If so then how it has been handled by application? And who handles it?
What is the biggest disadvantage of “Other Return Types” in Web API?
How to use multiple scriptmanager controls in a web page?
Explain the differences between managed and unmanaged code?
What are the benefits of Razor View?
What is the best Macanism to clear the Cache in asp.net
Why we use asp.net for website development?
Why do we need url encoding?
What are the asp.net list controls and difference between them?
How many types of validation are there?
How response object is related to asp's response object?