There are faults with this code.
The main one is that in a hosted situation, the app pool can recycle at any time, and there is no way you can control that. Another is that you are adding users as they log in, but you are doing nothing when users log out. Of course, many users never actually log out, so there's no reliable way to implement that functionality anyway.
Besides, the Membership system already tracks this information, so why reinvent the wheel? This should do the trick nicely.
Code:
protected void btnOnlineUsers_Click(object sender, EventArgs e)
{
IEnumerable<MembershipUser> users = Membership.GetAllUsers().Cast<MembershipUser>();
var onlineUsers = users.Where(u => u.IsOnline);
gvUsersOnline.DataSource = onlineUsers;
gvUsersOnline.DataBind();
}