views:

38

answers:

1

I want to know rough time when a member was last seen in the system.
I remember login for 2 weeks. So actual "ValidateUser" on MembershipProvider can be executed quite infrequently.

For now I just call DB.UpdateMembershipLastSeenTime() every time from RequireAuthorizationAttribute, i.e. on every authentication-requiring action.

Any recommendations/critique?

Framework: ASP.NET MVC 2.0 RC, IIS 7.0 (integrated mode), custom membership provider with storage in MS SQL 2008.

A: 

If you only care about rough estimates, you could do it in Application_AuthenticateRequest, Session_Start or Session_End in your Global.asax.

As long as they are already authenticated, this way it happens once each time they come to your website. This won't work of course if you've got a very lengthy session timeout.

womp