I have an ASP.NET website. I want the user to make a decision and click one of the given buttons for a certain period of time and redirect it to another page. If he doesnโt make a decision, he will still be redirected with the โno choiceโ mark in my head.
I use asp:Timer to initiate a postback after the time has ended. I am doing a redirect by calling Response.Redirect('page.html', false) in the Page_Load handler. In this case, I can handle button_click or timer_tick before actually redirecting. After processing one of these events, the page is executed and redirected.
But I have two problems. Firstly, if the input is processed long enough, the second timer works, a new postback starts, and my current is canceled! Secondly, if the user presses the button just before the time runs out, the timer is marked before the redirection is performed, and it will again override the user's click processing!
How can I solve these problems? How to disable the client-side timer after starting the first tick or after the user clicks a button? Or the best way to solve my problem? Thanks.
source share