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 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?
source
share