Is there a way to get the last login time from an SPUser object? I don't want the last login time to Active Directory, but specifically for the sharepoint site.
To my knowledge there is no direct way to retrieve this easily. Enabling Audit logs is not a good call as it creates a lot of data for nothing, and particularly it is per Site Collection, which leaves the question : "do you enable this for all site collections?" - you are in for a tremendous amount of information - weight that carefully.
In the past we've used 2 approaches:
- For SharePoint foundation we've build a simple HttpModule which does nothing else but recording some information we wanted to track user behaviour across many sites, etc.
- For SharePoint Standard and beyond, we used custom properties (which user could not change) and stored that in his User profile directly (SharePoint API is quite rich in this direction)
Your best bet on the sharepoint side would be the audit logs. You can enabled it to show a good amount of activity. So for your purpose, a login would most likely constitute a masterpage read. which would show up as:
Username viewed Document:site/_catalogs/masterpage/default.master