yad4u Last login time using the ASP.NET Membership API

Last login time using the ASP.NET Membership API

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?

ASP.NET MVC NerdDinner Tutorial question


Can submit buttons in Ajax forms have their name attribute set?
Try to call the line before you did the ValidateLogOn. Difference between window.location.href and top.location.hrefThe LastLoginDate is updated if Membership.ValidateUser is called, and I suppose you call this in ValidateLogOn. unable to download dynamically created fileSo if you start your LogOn with your current last line then it should commit you really the last login date..... Late binding operations cannot be converted to an expression tree with LINQ
Returning JSON data to view page in ASP.NET MVCAdding Include Files to the Add Controller T4 Templates in ASP.NET MVC


is there a way to programatically set a filter in jquery jqgrid?
The approach described here (Web Forms) when implemented similarly in MVC could be a more elegant quick fix - http://www.codeproject.com/Articles/16125/Getting-a-user-s-last-login-date-Before-it-s-updat.

66 out of 100 based on 41 user ratings 536 reviews