Hashtable Storing Users, but I have more than 2 things I need to store.
Posted on 2006-04-22
I'm currently doing something along the lines of
public Hashtable MyAppUsers
Hashtable a = (Hashtable)Application["CurrentUsers"];
if (a == null)
a = new Hashtable(2);
Application["CurrentUsers"] = a;
To store users in a C# website. Basically just doing a MyAppUsers.Add(key,data) and so on.
The key is the user login and the data is a date for the last time the hashtable entry was updated. I'm trying to figure out how I could also add an IP address in there as sometimes I have multiple people using the same login but not always fromt he same IP.
The only thing I can thing of off the top of my head is to make the key,value pair something like MyAppUsers(Login|IPAddress,Data) where Login|IPAddress is the key and the date is the value.
I would ideally want to have something like
and so on... with 3 values across but have no idea how to do it except for putting some delimiter in the Key and then parsing the key to get two values.