View Single Post
  #2 (permalink)  
Old January 16th, 2007, 04:55 AM
bunnyhopper bunnyhopper is offline
Registered User
 
Join Date: Jan 2007
Location: Sopron, Györ-Moson-Sopron megye, Hungary.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I think that the problem must lie within my DB routine class.

The class is using static methods and static members and I used to call it like this:

            
Code:
DB_Abfrage.InitializeSPCall("bbs_berichte_bloecke_select_insert_update_delete_EntryById");
Code:
            DB_Abfrage.AddParameter("@operation", "insert");
            DB_Abfrage.AddParameter("@bbs_berichte_id", int.Parse(bbs_berichte_id));
            DB_Abfrage.AddParameter("@bbs_blocktype", bbs_blocktype);
            DB_Abfrage.InsertUpdateDeleteQuery(true);


But than I read this on a site:

The Web server does not run a separate copy of your application for each user accessing your web site. Bear this in mind as you read through the rest of this article, because you don't want to code global static variables as if each user has a separate copy of them. For per-user data, use session variables instead. For information on session variables, search the MSDN online help for HttpSessionState. Even though there are multiple HttpApplication instances, there's still no guarantee which of these are shared among which users. Each user accessing the site does not necessarily get his own instance of HttpApplication.

So my question is. Could it be that when the class accesses a static member, the static member is not the same as before or that other users access the same static member and corrupt the data stored in it? Does it make sense to use static member in a class (with ASP.NET) at all?

Until now I rewrote the entire DB class and now it is using session variables instead. I hope this was the problem.