Save User Login History on Session Created

Jan 11, 2015 at 12:27 PM

I'm working on a prototype site using ASP Identity. I've created a standard MVC project with all the template code. The only thing I've done differently is remove the dependency on Identity Framework and I've created a custom "UserStore" that interfaces with our existing WCF services.

Everything is working as expected but I can't seem to find anyway to implement the last business requirement : Every time a user log's in or a new session is created, store the login details for compliance requirements. (Essentially, the user leaves the site, comes back much later and a new session is created but the user is still logged in)

Now compliance is a bit misleading, essentially we have a small collaboration platform that allows for external logins (Facebook & Twitter). There is no requirement to force the user to log in each time but when a new session is created for a previously authenticated user, we just need to store some very basic "audit" data.

I've tried looking everywhere for such a method, essentially I assume it's when the cookie is read and re-validated. I'm however not coming right.

I don't want to store and check for a certain key in the user session (easily achievable) but I'm suspecting that we'll probably run the application in the cloud in the foreseeable future.

Please can you point me in the right direction.