string machineName = WindowsIdentity.GetCurrent().Name.Split('\\')[0];
PrincipalContext c = new PrincipalContext(ContextType.Machine, machineName);
//Specific User
1 UserPrincipal uc = UserPrincipal.FindByIdentity(c, "Rashid");
2 DateTime? LoggedInTime = uc.LastLogon;
//Current LoggedIn User
3 uc = UserPrincipal.FindByIdentity(c, userName);
4 DateTime? CurrentUserLoggedInTime = uc.LastLogon;
above 4 steps displaying nothing