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?




how do i load thousands of rows in my asp.net mvc project from database into slickgrid?

1:



HTML.DropDownList values from multiple sources?
Try to call the line before you do the ValidateLogOn.


Authentication for IIS content in virtual directory under ASP.NET MVC website
The LastLoginDate is updated if Membership.ValidateUser is called, and I suppose you call that in ValidateLogOn.


How can I get the client side date and currency formats?
So if you start your LogOn with your current last line then it should give you really the last login date.....
When to use Singleton vs Transient vs Request using Ninject and MongoDB


ASP.NET MVC Registration With Captcha


ASP.NET MVC: Why is `ToMvcHtmlString` not public?

2:



What is a good strategy for dealing with large javascript code in asp.net MVC projects?
The approach described here (Web Forms) when implemented similarly in MVC could be a more elegant solution - http://www.codeproject.com/Articles/16125/Getting-a-user-s-last-login-date-Before-it-s-updat.



66 out of 100 based on 21 user ratings 1046 reviews

@