Last login for a user?

Is there anyway to find out when a user was last login to EPi? On our site, all users have to register to be able to purchase or download and we currently have 11000 registered users. My guess is that about 50-60% of them never log in and these accounts should be deleted... but how would i know if the account is still in use?
Feb 11, 2008 16:39
Hi Jonas! If this is an EPiServer4.x site and Your using the builtin database authentication provider (users stored in EPiServer's database) then No, there is no "last login date" available. Such functionality could howevere quite easily be developed, one approach (amongst others) would be to programmatically store the current date/time in the users profile upon each request (or each login). Something like this: UnifiedPrincipal user = UnifiedPrincipal.Current; if(null!=user) user.UserData["lastAccess"] = DateTime.Now; Then, to find users that either lacks the "lastAccess" time or where it's further back than some threshold, code like this could be used: foreach(Sid sid in Sid.List(SecurityIdentityType.AnyUserSid)) { UserSid user = sid as UserSid; if( null==user["lastAccess"] || DateTime.Now.Subtract((DateTime)user["lastAccess"]).TotalDays > 14) { // do something with 'user' here, possibly delete it or inactivate or send an bump-email... } } Regards, Johan Olofsson
Feb 13, 2008 10:52
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.