您的位置:首页 > 其它

定时触发函数这System.Timers.Timer对象

2010-07-15 19:37 429 查看
①首先,在WebSite里追加一个Gobal Application Class。
<%@ Application Language="C#" %>

<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
System.Timers.Timer timer = new System.Timers.Timer();
timer.AutoReset = false;
// 定时一分钟
timer.Interval = 60000;
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
timer.Start();
}

void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
// 在这里调用你想调用的方法。
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: