How does a static interfere between sessions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

My question is if and how a static variable remains the same state if more than one session of my web site is running. Is the content of my static different at all sessions
or not.
For sample session 1 - Static int = 10
session 2 - Static int = 8
If a third session is running does the static interfere with the other sessions, or not.
I know maybe my quesxtion is a little bit silly, but i have problems in that kind and
ne not sure why.

Thanks a lot for answers
Bye
 
Harald said:
Hi

My question is if and how a static variable remains the same state if more
than one session of my web site is running. Is the content of my static
different at all sessions
or not.
For sample session 1 - Static int = 10
session 2 - Static int = 8
If a third session is running does the static interfere with the other sessions, or not.
I know maybe my quesxtion is a little bit silly, but i have problems in that kind and
ne not sure why.

Statics have nothing to do with sessions.

You should almost certainly not be using statics at all.
 
Hi,

A static member has application scope, meaning that all the sessions use
the same static member , you should be carefull when using it because of
threading issues, take a look at Skeet's singleton document as an example of
static member problems and how to solve them.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Harald said:
Hi

My question is if and how a static variable remains the same state if more
than one session of my web site is running. Is the content of my static
different at all sessions
 
Back
Top