I have an ASP.Net MVC 5 application that uses Identity 2 for authentication (using the standard cookie authentication middleware configured with ExpireTimeSpan = 30 minutes and SlidingExpiration = true).
I set authentication to expire after 30 minutes, and I need to check from the client side if the user is still logged in. I could make a simple AJAX call for this, but it will update my session and reset the timeout that I want to avoid. Using a 30-minute timeout in Javascript will only work if the client has only one tab open in my application, which I can not guarantee.
I was thinking of adding a custom attribute to an action that could check if authentication is valid, but without resetting the timeout. Is there any way to do this?
Alternatively, this could probably also have been done using OWIN middleware, but again, I don't know how to authenticate without resetting the timeout.
source share