View Single Post
 
Old July 17th, 2007, 01:48 AM
shujamughal shujamughal is offline
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with static variables behaviour

Hi
I have made an asp.net application in which i have use static variables so i can use these values from one page to other

page or on the same page (on the same page bcoz if i use simple variables then on page postback these variables loss

their data).
Now I publish this application on local intranet. now suppose if i initialize this varibale say( myStaticVar )to 0 as follow

myStaticVar =0.

if there are two users that access this application and one user change its value to 1
myStaticVar =1
then the problem occurs that the second user also get the change value.This means the application is not thread safe. how

this problem can reslove to seperate each user's values to other user's data. as i have declare so many static variables in

my application.
Thanks in advance.