在global.asax 中使用.


Timer timer;

    Timer timerUrl;

    void Application_Start(object sender, EventArgs e)
    {

        TimerCallback callBack2 = new TimerCallback(Test2);
        timerUrl = new Timer(callBack2, sender, 1000, 1000);
    }

    private void Test2(Object state)
    {
        // 定时操作写到这里
       }

 

    void Application_End(object sender, EventArgs e)
    {
        timerUrl.Dispose();
    }

posted on 2007-08-20 17:43  自由港  阅读(1973)  评论(0编辑  收藏  举报