Home  >  Article  >  Web Front-end  >  How to use System.Timers.Timer in asp.net_javascript skills

How to use System.Timers.Timer in asp.net_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:40:01998browse

We often add some regularly executed tasks to the website, such as generating static pages, sending emails, etc.

This can be achieved by setting this in Global.asax.

Copy code The code is as follows:

void Application_Start(object sender, EventArgs e) {
MT.Enabled = true;

MT.Interval = 1000;

MT.Elapsed = new System.Timers.ElapsedEventHandler(MTimedEvent);

}

void MTimedEvent(object source, System.Timers.ElapsedEventArgs e)                                    

void StartWork()

{

//The executed code is written here

}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn