Search code examples
asp.netauthenticationasp.net-membership

adding additional functionality to the asp.net login component


I am using the default login component for my logging in and out and im wanting to add some additional code to allow me to track if the user is online or not i have created a attribute in the asp_users table called online im wanting to when the user has logged in and they are authenticated it to then change the online attribute to 1 then when the user presses logout it changes it back to 0 i can easily change the attributes its just adding to the login and out code.


Solution

  • The LastActivityDate + UserIsOnlineTimeWindow tracks already if the user is currently logged in(Date.Now - UserIsOnlineTimeWindow <= LastActivityDate).

    Here are more informations: https://web.archive.org/web/20211020150010/https://www.4guysfromrolla.com/articles/041608-1.aspx

    According to the time issue:

    Coordinated Universal Time, or UTC time, the standard international time that all time zones are expressed as offsets of. UTC does not get adjusted for daylight savings. To compute local time from UTC, simply add the time zone offset and then add an additional hour if daylight savings time is in effect. UTC time is commonly used to store date/time values in database systems because it is not tied to the database server's time zone.