How do static properties work in an asp.net environment?

前端 未结 4 2070
南旧
南旧 2020-12-03 21:13

If I had a class with a static property that is set when a user loads a particular page, is that static value unique to that users session?

In other words, if a seco

4条回答
  •  执笔经年
    2020-12-03 21:20

    Static fields and properties are shared across all instances of a class. All of your users will end up sharing the same value.

    The value will be there until the ASP.NET worker process recycles itself (which happens periodically).

提交回复
热议问题