Tuesday, August 01, 2006 5:19 AM
Trivium DawnWalker
Static Variables
OK!
Its official. Static variables are really really really evil. and naturally I found out the hard way. Now I have used static variables in a few places. Usually just to keep track of who has what permissions on the current page, the PrimaryKey of the entry they working on and so forth.
To my surprise, we have discovered that these static variables are carried between user sessions. And by that I don't mean you log off and log back on and the variable still has a value. I mean, that when a variable is assigned a value due to one of MY actions and YOUR variable then has the same value as mine if we are logged in at the same time and working on the same page.
So if anyone has been wondering, STATIC VARIABLES ARE THE ROOT OF ALL EVIL IN ASP.NET!!!!!!!!!!!!!!!!!!
I know this is my fault for not knowing my basics inside and out but I never thought that would be possible. Oh well, there's only another 9 projects I need to changed and re-deploy.
BTW: anybody wanting to know how the GAC works check out : http://graysmatter.codivation.com/MyGrandmotherAndTheGlobalAssemblyCacheAndStarWars.aspx
its a great article!
Filed under: ASP.NET 2, General