In any case, can I create a function that receives both the username and the function returns if the user is currently logged into the application?
Take a look
this.Page.User.Identity
The class System.Web.Security.MembershipUserhas a IsOnlineboolean property , so you can do something like this.
System.Web.Security.MembershipUser
IsOnline
MembershipUser user = Membership.GetUser(username); if (user != null) return user.IsOnline; // handle User not found here, or just return false.. return false;
Session.Add("CurrentUser", currentUser);
, . ASP.NET #, , .
_currentUser = ([].User)Session["CurrentUser"]; if (_currentUser != null) { }
Source: https://habr.com/ru/post/1760766/More articles:How to Change IIS 7 Application Settings Using C # - c #Image Stabilization / Alignment Algorithm - algorithmWhat is the best way to handle multiple mail servers in the mailSettings section of the web.config file? - c #Using Events / Commands with XamlReader - c #Custom match with Moq - linqPHP: func_get_args performance? - performanceSuperuser Access by Country - pythonInexplicable results with VS2008 "Get All ..." - tfsandroid: background hides my text - androidMVVM - how to show view? - viewAll Articles