As far as I can tell, the main implementation of .Net lastuserlogin membership entries, but does not track every login, I need to do something now. I did some research, and I'm sure one approach is to create a custom class that extends an existing provider with this function and adds an event table to the schema to record each entry.
I saw several articles about this - the closest, probably this is one from Scott Mitchell http://dotnetslackers.com/articles/aspnet/Tracking-User-Activity.aspx , but it's from November 2008 and I'm curious if would someone point me to the best solution for this or confirm that this is still the βbestβ way to handle this. I would suggest that this is a fairly common requirement. I still click on .Net (using C #), so any information would be appreciated.
EDIT
Progress, but not yet complete. I added the following code to create a new entry in the login activity table:
if (Request.IsAuthenticated) { MembershipUser currentUser = Membership.GetUser(false); string App1 = Membership.Provider.ApplicationName; string username = currentUser.UserName; object guid1 = currentUser.ProviderUserKey; aspnet_CustomActivity login = new aspnet_CustomActivity { UserId = (Guid) guid1, ActivityID = 1,
So, I have a little problem when I noticed that ApplicationName is empty, and when I tried to change it in the web.config file, it caused an error loading currentUser.username, but I think I can do it.
What I need to do now to finish is link this to the login page, and I think I can do it based on the tips below. I will send again when finished to complete the answer.
source share