[RESOLVED] Class File - Timing Issue?
I have c#/asp.net web application which has several aspx.cs. I have created a class file(cs) that contains variables and methods that is used through out the applications. My problem happens only occasionally which I believe is an timing issue among multiple users. With the debugging I have done, it appears that the variables in the class file is trying to be updated at the same time. I was thinking that the each user had their on copy of the class file, appears that is not true. What is the best practice to be able to use the same variables & methods in the class file among multiple users without mixing up the data. Is there a way to isolate each users data without declaring the same variable in each aspx.cs.
The application was originally written using VS 2005, but been using VS 2010 for the past year for modifications.
Re: Class File - Timing Issue?
Here is the answer I got from another forum:
You will only see non-static properties/functions etc on an instance of the class. ie;
clsIncidFrom myClass = new clsIncidFrom();
myClass.NonStaticProperty = "hello";
myClass.NonStaticMethod();Whereas static properties and methods are on the class type itself, but they are shared across all users and are considered global. Each user doesn't have their own copy of the data;
clsIncidFrom.StaticProperty = "hello";