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

后端 未结 5 1063
醉酒成梦
醉酒成梦 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:25

    Static data is shared among the entire application domain of your webapp. In short, it's shared among all the threads serving requests in your webapp, it's not bound to a session/thread/user in any way but to the webapp as a whole.(unlike e.g. php where each request lives in its own isolated environment bar a few knobs provided - such as the session variable.)

提交回复
热议问题