Re: Session state issue
- From: "Hans Kesting" <news.1.hansdk@xxxxxxxxxxxxxxx>
- Date: Mon, 14 Nov 2005 09:52:35 +0100
This much I know.
What I dont know is why code behind variables default as application state. Or perhaps its becuase I decared them as Static but they will not work otherwise.
Have any insight to this?
Static variables are defined at *application* level. Remember: an asp.net application is a *single* application, serving *multiple* concurrent users. This in contrast to a "winform" application, where every user has his/her own application.
Hans Kesting
"Daniel Walzenbach" wrote:
Sean,
application state is shared across every instance of your application whereas session state is specific to one user. Application state lives as long as your application lives, session state on the other hand lives only as long as one session lives.
Example:
Assumption: Nobody ever logged on to your application
User 1 access your application
Events:
Application start (this is for the whole application. What you set in here will be visible to all users)
Session Start (this is only for user 1 accessible)
User 2 access your application
Events:
Session Start (note that only session start fires. The application is already running)
User 1 leaves your application.
Events:
Session End (This event fires after the session times out. This duration is most prob. Set in your web.config. Usually this is 20min. This event DOES NOT fire when the user closes the browser. Don't confuse this)
User 3 logs on
Events:
Session Start (note that only session start fires. The application is already running)
User 3 leaves your application.
Events:
Session End (This event fires after the session times out. This duration is most prob. Set in your web.config. Usually this is 20min. This event DOES NOT fire when the user closes the browser. Don't confuse this)
User 2 leaves your application.
Events:
Session End (This event fires after the session times out. This duration is most prob. Set in your web.config. Usually this is 20min. This event DOES NOT fire when the user closes the browser. Don't confuse this)
Events
ApplicationEnd (This event depends on your settings. After some time when nobody is accessing your application the application shuts down. Application state is lost)
Does this help? Have a little background reading at
http://www.msdn.microsoft.com/asp.net/archive/default.aspx?pull=/library/en-us/dnpag/html/scalenetchapt06.asp#scalenetchapt06_topic16
Best regards
Daniel Walzenbach
"Sean" <Sean@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag news:14708908-E324-4688-8BB7-A676B31629B5@xxxxxxxxxxxxxxxxProblem with sessions
I have created an application without concern for sessions. As it turns out
I think that might be my undoing.
What I have: I have an online quiz. I don't need to know users or save any data. If the application crashes or user exits the program they should simply start again. Pretty basic. All interactions are stored in an array (not much going on to save to a file) and that is that.
The problem:
All changes and interactions are being saved to the application state. So if
computer 1 changes values, it also changes values on computer 2. I don't want
this. Furthermore, if I close the window and reopen it all the values are
still there which is why I suspect the values are being stored in application
state.
Am I going to have to re-design all my variables to be session state variables?
.
- References:
- Re: Session state issue
- From: Daniel Walzenbach
- Re: Session state issue
- From: Sean
- Re: Session state issue
- Prev by Date: Rowfilters Mathematical Representation
- Next by Date: Re: Session state issue
- Previous by thread: Re: Session state issue
- Next by thread: Re: Session state issue
- Index(es):
Relevant Pages
|