c# - Timer on Server Side? -
i want have timer update global variable every 10 sec, put timer in global.asax.cs:
void application_start(object sender, eventargs e) { timer atimer = new timer(); atimer.interval = 10*1000; atimer.tick += atimer_tick; atimer.start(); } void atimer_tick(object sender, eventargs e) { // update data } but weird thing nothing happen after 10 sec. wonder if possible that?
thanks in advance.
use system.timers.timer instead of system.windows.forms.timer
the former uses elasped event handler , function expected anywhere in application. latter tailored winforms , should used on form1_load() not on application start.
Comments
Post a Comment