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

前端 未结 4 2072
南旧
南旧 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条回答
  •  萌比男神i
    2020-12-03 21:18

    No, it's nothing special just because it's asp.net. ASP.NET itself is just a regular .NET assembly collection. If you want to save things per sessions then you should use the session state. If not, be careful since there are many threads that can access your static data. You should read and learn how threads, locks and race conditions work together.

提交回复
热议问题