How to find the users who are logging in to my ASP.NET web application at any given time

124 Views Asked by At

I'm using forms authentication to log users into an ASP.NET application. My code is like this.

        if (txtPassword == correctPassWord)
        {
            FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, txtUserId.Text.Trim(), DateTime.Now, DateTime.Now.AddMinutes(30), false, "");
            string cookiestr = FormsAuthentication.Encrypt(tkt);
            HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
            ck.Path = FormsAuthentication.FormsCookiePath;
            Response.Cookies.Add(ck);
            Session["UserId"] = txtUserId.Text.Trim();
            Response.Redirect("~/Default.aspx");
         }

I need to find the user IDs who are logging in into the system at any given time. Is there a way to find out which users are using the application without saving the user to the database.

0

There are 0 best solutions below