|
-
Jan 16th, 2012, 04:41 PM
#1
Thread Starter
Frenzied Member
ASP.NET Membership provider problem
One of the database fields that the ASP.NET Membership provider manages is the "LastActivityDate" field. We are attempting to utilize this field to determine the last time the user was online. Yes, I know there is a LastLoginDate as well, but that is just that a Login date. Anyway, getting back to LastActivityDate, it seems that this field is being updated at random times and not by the user. We know this because it is happening to user accounts that have never logged in and blocks of users are getting this field updated at the exact same time.
So the question is, is there any reason why the ASP.NET Membership provider would be updating this field at random times? Or is there possibly some other environmental culprit here? This is a hosted web site, so I'm wondering if there is something in the hosting environment causing this.
Any pointers would be appreciated.
-
Jan 16th, 2012, 04:59 PM
#2
Thread Starter
Frenzied Member
Re: ASP.NET Membership provider problem
I may have found the answer to this. It seems that calling GetUser with certain arguments will cause this field to be updated. I have to go through the code that someone else wrote and see if this is the cause.
-
Jan 17th, 2012, 02:18 AM
#3
Re: ASP.NET Membership provider problem
Hello,
Interesting, I wasn't aware that this happened.
Would be interested to hear which particular set of parameters resulted in changes to the database field. The fact that it is doing this, sort of fly in the face of the name of the method, i.e. GetUser. I wouldn't have expected this to make any difference to the underlying database row for that user.
Gary
-
Jan 17th, 2012, 11:09 AM
#4
Thread Starter
Frenzied Member
Re: ASP.NET Membership provider problem
Well, if you think about it, it does sorta make sense. How else would you be able to tell if someone is "online", given the stateless nature of the web? You have to resort to tricks like this. When the user is online "doing stuff", you are presumably calling GetUser() to validate that user or to retrieve user related info. It is at this point in time that it would make sense to log that the user is active. Although, maybe a method called "SetUserActive()" would have been more intutitive. I wonder how many people don't realize that calling GetUser() with certain arguments causes this field to be updated?
The bad thing, in my case, was that we have an administrator screen that does all sorts of stuff. We are calling GetUser() all over the place, thus creating a false positive for the user showing as online.
Good thing is, I discovered it is well documented which calls to GetUser() cause the LastActivityDate to be updated: http://msdn.microsoft.com/en-us/library/8tytf0xz.aspx
Last edited by softwareguy74; Jan 17th, 2012 at 11:20 AM.
Visual Studio 2010
-
Jan 18th, 2012, 02:40 AM
#5
Re: ASP.NET Membership provider problem
Hello,
Agreed, I thought that either UpdateUser(), or as you say a SetUserActive() method would have been created for such a purpose.
In the admin console are you able to get done what you need based on the overloads that don't set the last activity field?
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|