Can sessions conflict when encapsulating in a static property of a static class?

I have an ASP.NET application that 120-140 users are accessing at the same time. I use Session to get and set user information. To simplify the task, I have a static class with a name CurrentSessionand it has the property UserInfo:

public static class CurrentSession{
     public static UserInfo{
          get{return HttpContext.Current.Session["userInfo"]!=null?(UserInfo)HttpContext.Current.Session["userInfo"]:null;}
          set{HttpContext.Current.Session["userInfo"]=value;}
     }
    //And other properties
}

And whenever I need the current user information that I just used:

CurrentSession.UserInfo;

Recently, I came across situations where incorrect user information is retrieved. Is there a problem in my approach that can cause conflicts Session?

+4
source share
1

. , static. , HttpContext.Current static. .

+1

Source: https://habr.com/ru/post/1568612/


All Articles