Re: Session state issue

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Static variables are shared across the application.  If you can't use non static variables, see if you have any static methods using these variables?  Are these methods supposed to be static?


On Mon, 14 Nov 2005 05:50:06 +0100, Sean <Sean@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

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?

"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@xxxxxxxxxxxxxxxx
> Problem 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?
>





.



Relevant Pages

  • Re: Session state issue
    ... > whereas session state is specific to one user. ... Application state lives as ... > This event DOES NOT fire when the user closes the browser. ... Don't confuse ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session state issue
    ... whereas session state is specific to one user. ... Application state lives as ... This event DOES NOT fire when the user closes the browser. ... Don't confuse ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Session_End
    ... For example the SQL Server session state provider uses a job to perform ... "Guadala Harry" a écrit dans le message de ... > that Session_end would fire for every session end. ... > fire under normal circumstances (nothing special for state server, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: session on end
    ... > offhanded reference to the unreliability of session on end. ... The real word is that it may not fire when you want or expect it to fire. ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Try...Catch...Finally not firing finally?
    ... always fire, there's an implicit guarantee for that. ... the Finally closes the connection. ... finishes the Catch then fires the Finally, which closes the session. ...
    (microsoft.public.dotnet.framework.aspnet)