Why does my ASP.Net static function's “context” crossover between user sessions?

后端 未结 5 1064
醉酒成梦
醉酒成梦 2020-12-16 03:58

I think I need some help understanding how static objects persist in an ASP.Net application. I have this scenario:

someFile.cs in a class library:

p         


        
5条回答
  •  既然无缘
    2020-12-16 04:32

    One solution you might consider is using [ThreadStatic].

    http://msdn.microsoft.com/en-us/library/system.threadstaticattribute(VS.71).aspx

    It will make your statics per thread. There are cavaets however so you should test.

提交回复
热议问题