I want to find out the last login time for a user in my ASP.NET MVC 1.0 application. I'm using the Membership provider for authentication. Although I'm able to retrieve the last login time using:
public ActionResult LogOn(string userName, string password, bool rememberMe, string returnUrl)
{
if (!ValidateLogOn(userName, password))
{
return View();
}
string lastLogin = Membership.GetUser(userName).LastLoginDate.ToString();
This returns the current time from the column LastLoginDate from aspnet_Membership table. Is there a way to tap into the former login time before the records get updated? Are cookies the only way to do this?