Click here to Skip to main content
15,937,127 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Good evening to all in my project on of the page contain Timer.Set 12o minutes for timer according to various condition the timer some time stopped before reached 0.The problem is if i refresh the page before reach the timer 0 then the timer start from 120. so i want to disable browser refresh button .how can i do it please help meany one.

thanks in advance
Shahin Khorshidnia 9-Jul-12 6:13am    
Why don't you initialize the timer in if(!IsPostBack) {...} block?
Sandeep Mewara 9-Jul-12 6:58am    
Title says 'back button', details say 'refresh button'

You cannot handle browsers back button or refresh button 100%. There are multiple ways and scenario that can trigger either of them.

Instead, your design/implementation should be such that it is not affected by such interferences.

Here, in case of timer, refresh would reset it if the timer is on client side. You need to put some logic to track time on server side and validate it. Handle refresh occurance if it happens. Further, put a red message and display it to user that 'DO NOT REFRESH' or you will loose something ;)

Just for validation purpose:
Refresh Page Issue in ASP.Net[^]
Stop Refresh after Submitting your Request[^]
Detecting Page Refresh[^]
Share this answer
you can use some viewstate or cookies to save the timer value.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900