User-474980206 posted
this is done with javascript, browser session storage and and timer:
@if (firstPage) {
<script>
// render on frst page
sessionStorage.setItem("timer", @maxSeconds);
</script>
}
<script>
// get saved time
var remainingSeconds = sessionStorage.getItem("timer") || 0;
var timer = setInterval(function() {
--remainingSeconds;
if (remainingSeconds < 0)
{
// stop timer
clearInterval(timer);
// do end of timer stuff
alert("times up");
}
},1000);
</script>
note: if you must support older browsers, you should use a hidden field included with the post data