What is better: Static variable V.S. Asp.NET Application Session?

前端 未结 4 1751
难免孤独
难免孤独 2020-12-17 22:41

Say you want to share some resource, like a class or a variable across all threads/sessions within a ASP.NET web application. What is better?

1) A static variable h

4条回答
  •  无人及你
    2020-12-17 23:11

    That's true session variables should only be used for if you want to store the value for the whole session, but in the case you want the variables to be intitialized and to be used in between the forms and if changed in betwwen should be available through the whole application for the same object must use static variables.

提交回复
热议问题