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
Describe paging in asp.net?
What is a form tag?
Explain the role of global.asax?
What is session mode in asp.net?
Explain what are delegates?
What is session and cookies in asp.net?
What r the asp.net list controls and diff. Between them?
Explain Optimization technique description?
Why do we need master page in asp.net?
What is asp.net futures?
what is publisher?
Why does my asp.net file have multiple tag with runat=server?
How about the security in Activex DLL and Activex EXE ?
How can i explain my project during interview?many time i expalain my project but they did't accept? please explain me.
Explain how can we inherit a static variable?