471,071 Members | 1,508 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

How does a static interfere between sessions

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
Nov 18 '05 #1
2 1082
"Harald" <Ha****@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
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" <Ha****@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Earl Teigrob | last post: by
1 post views Thread by Chris Bardon | last post: by
6 posts views Thread by Marek | last post: by
5 posts views Thread by Tom Pearson | last post: by
4 posts views Thread by Michael | last post: by
4 posts views Thread by =?iso-8859-1?B?Sm9oYW4gU2r2c3Ry9m0=?= | last post: by
113 posts views Thread by John Nagle | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.