Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. "Who is Logged in" module

"Who is Logged in" module

Scheduled Pinned Locked Moved ASP.NET
databasedata-structureshelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrcooll
    wrote on last edited by
    #1

    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);
                }
            }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups