Home  »  Forum  »  ASP.Net  »

what is the difference between session , application and cache in asp.net?

 Posted By : rashmi rashmiPosted Date : 26/04/2012 03:33:47 PM Category : ASP.Net Points : 1

As both are server side state management where  we will use session and in which situation we will use Application ??

One more question Where data are storing and where the session Id is storing ??in  clients browser or server??

 Author : Manoranjan Sahoo Member Level : BronzeDate : 27/04/2012 08:12:39 PM Points : 4

Yes, Both application and session are server side state management. You can choose session and application state management as per our requirement. If you want to access the same state variable in all session then you must save that value in application state variable because this is the global object. But session is not global object, it creates new session every time a new user enters into the application.

Ex : Session : suppose you want to store some specific user information for some time till the user access the page and no other user can access that value then you have to save those value in session variable. 

Application : suppose you want to show the number of user currently access to the site to all the user then you need to set some counter and need to save that in some variable.

It means you have to access that variable by all user. At this time you need to store the variable in application state varible as this is store in global object.


Hope this will help you.

 Author : Gopesh Sharma Member Level : BronzeDate : 09/10/2012 11:52:55 AM Points : 2


Application Variable: Application state variables are global variables for each ASP.NET application, and this variables can be used anywhere in your application.

Session Variable: You can store values to this variable where you want to store data of a particular session, like whenever a user logs in, and this session data will be removed, whenever the user logs out.

Post Reply
Login to post Response.