Recently, for a project, the data for a table needs to persist during the session. Because it's what someone else has done, it follows the original style of static variables to store the data :
public static list<word> words=wordrlist;
Later in the test found that with chrome and IE Open the project at the same time, the data will be overwritten, for example, Chrome passed in data a, and then IE passed in data b.
At this point , Chrome does nothing, just refresh, will find that the original data a into data b, that is, the static variable is the new data to be overwritten. Wouldn't it be a mess to use static variables for user variables?
This time should use the Session to replace the static variable: session["WordList"]=wodrlist;
Session is the server dedicated to the user variables of a mechanism, different users use the session is independent of each other, non-interference. Static variables are stored separately in the shared memory, that is, any user used static variable is actually the same, User B changed its value, User a before the value of the assignment is overwritten, see also User B assigned value.
All said that, in general web development, the user's personal data are stored in a cookie or session of this variable. Static variables are used for public data, such as the number of visits to a portal site or chats on a chat site.
Static variables and the use of the session