In my web app, multiple users(more that 100) can login simultaneously. I need to maintain state of these users. If 100 users login at once, state of 100 users has to be maintained. I need UserID, Email and other properties during execution of code.
I had used static properties which is shown below in code. But this resulted to clashing of users.
I am thinking of using singleton pattern but it also has static property so I am not sure if it fulfills my need.
I also thought of using HttpContext.Current.Items
but found out that it is per request. So, I think value added here will flush on every next request.
//code that clashed users
Public class UserHelper
{
public static int UserID
{
get;
set;
}
public static string Email
{
get;
set;
}
}
What is the best practices to accomplish this task efficiently?