ASP.NET Forms Authentication - Alerting the User to End Session
I have an ASP.NET 3.5 application using forms authentication.
It would be nice to be able to warn the user that their login session will timeout. I think this will require some AJAX / JQuery, but that's all I have.
You can just use setTimeout with a time period before the session expires and do something like alert () a minute or so earlier. Therefore, if you have a session timeout of 20 minutes, you can make an alert after 19 minutes of inactivity.
Edit as others have suggested there are alternatives (possibly better). Take a look at this for an example.
Typically, when do you inform the user? If you make a request (Ajax or otherwise) then the session will not time out, because the very act of the request will delay the session timeout later.