"Who is Logged in" module
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
hi all i want to list all of the logged in users on a page , i did it fine but i have a problem when the user close the browser i cant remove them from the list, how can i get use of Session_End in the Global.asax . this code is in Global.asax
private Code.BL.Users.SysUserCollection users = new Code.BL.Users.SysUserCollection();
public Code.BL.Users.SysUserCollection OnLineUsers
{
get { return users; }
set { users = value; }
}this code is in BL
public class SysUserCollection : IList<SysUser>
{List<SysUser> users = new List<SysUser>(); #region IList<SysUser> Members public int IndexOf(SysUser item) { return users.IndexOf(item); } public void Insert(int index, SysUser item) { throw new Exception("The method or operation is not implemented."); } public void RemoveAt(int index) { users.RemoveAt(index); } public SysUser this\[int index\] { get { return users\[index\]; } set { users\[index\] = value; } } #endregion #region ICollection<SysUser> Members public void Add(SysUser item) { if (!this.Contains(item)) { users.Add(item); } } public void Clear() { users.Clear(); } public bool Contains(SysUser item) { foreach (SysUser user in users) { if (user.UserId == item.UserId) return true; } return false; } public void CopyTo(SysUser\[\] array, int arrayIndex) { throw new Exception("The method or operation is not implemented."); } public int Count { get { return users.Count; } } public bool IsReadOnly { get { throw new Exception("The method or operation is not implemented."); } } public bool Remove(SysUser item) { foreach (SysUser user in users) { if (user.UserId == item.UserId) { return users.Remove(user); } }