Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling a method on Session Timeout?

Tags:

asp.net

I have a website with multiple pages. Each page has a "Save as Draft" method that will save the users progress. I have a session timeout of 40 minutes, and I was wondering how I would make it so that whenever the session is expired, the page automatically calls "Save as Draft" (so it's not lost)

How would I start on doing something like this?

like image 838
proseidon Avatar asked Dec 04 '25 11:12

proseidon


1 Answers

You can't: the session expires server side and cannot send a message to the browser (it doesn't even know whether the user still sees the page or has closed the browser).

You could set a client-side timeout to save the page (as draft) to the server, but this has the effect of refreshing the session! So maybe just do an automatic "save as draft" every 5 - 10 minutes, thereby keeping your session (plus a draft copy of the work done).

like image 61
Hans Kesting Avatar answered Dec 06 '25 02:12

Hans Kesting



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!