2
votes

I'm using ASP.Net Identity & OWIN for login purpose. Everything has been working properly before comes new requirement as follow:

"User is successfully logged in and for a certain period of time (ex: 10 minutes) the user not landed into the page, so the user's session timeout is expired and the page should redirect to login page with Error Message "Your login session has expired! Please log in again."

How I can setup my configuration to meet that requirement?

Your feedback is really appreciated.

Thanks, AnasDove

1
welcome to SO! Can you display your Startup.cs? We are not sure what are you using a cookie based authentication or a token based authentication. Please provide some code at leastDarkMakukudo

1 Answers

0
votes

If I correctly understand your requirement. you want to redirect user to login page after timeout, without page refresh. if this is what you want solution would be something like that:

  1. persist users sign-in datetime Somewhere (db or whatever else)
  2. you want some background worker something like Hangfire to find user who needs to login again by users sign-in date persisted before
  3. then you can use Real Time library signalR which is responsible for push content to connected clients instantly, without page refresh.
  4. in your client code put redirection logic and you are done