You would think it would be a fairly straight-forward problem, but I'm struggling a bit with designing a feature to store the last logon date / time in an ASP.Net (MVC) application.
My first instinct was to simply store the value in the database against the user's profile record and update the value to the current date/time on successful login. Of course, as soon as I record that value, all pages will display the date and time of this session's successful logon.
Plan B: A field to record the previous session and one to record this session. On logon, save this session's date/time to the "current" field and move the value previously found there into the "previous" field (obviously). It is this field that provides my "last logged in on" value.
Is this the best approach or can it be done more elegantly?