Does static reference to HttpContext.Current.Session return same session for all users?

后端 未结 2 568
一向
一向 2021-01-06 03:28

Is there room for issue in the following code in terms of multiple users of the same web application? I mean, I know that a purely static string will be shared across all se

相关标签:
2条回答
  • 2021-01-06 03:40

    HttpContext.Current always returns the context of the current request (if there is a current request).

    Since each user will be executing a different request, each context will be different.

    0 讨论(0)
  • 2021-01-06 03:46

    Your property is static. This is actually the cause of sharing the property between users.

    See Scope of static Variable in multi-user ASP.NET web application for more details.

    0 讨论(0)
提交回复
热议问题