在Global.asax中: void Application_Start(object sender, EventArgs e) { //定时时间差 TimeSpan times = new WebCommon().getNextBroadRoomSortTime() - DateTime.Now; System.Timers.Timer myTimer = new System.Timers.Timer(Convert.ToInt32(times.TotalMilliseconds)); myTimer.Elapsed += new System.Timers.ElapsedEventHandler(myTimer_Elapsed); myTimer.AutoReset = true; myTimer.Enabled = true; //关键在于此:将Timer对象赋予Application对象,使其在.NET应用程序中的任何地方可调用编辑 Application["Timer"] = myTimer; } private void myTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { Application.Lock(); //定时器到时时,所要实现的操作功能 Application.UnLock(); }