Copy codeThe Code is as follows:
<% @ Application Language = "C #" %>
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. SqlClient" %>
<% @ Import Namespace = "System. Collections" %>
<% @ Import Namespace = "System. IO" %>
// Introduce the class library
<Script runat = "server">
// Add by chairuirui 2013-3-26
Void Application_Start (object sender, EventArgs e)
{
// Code that runs when the application starts
System. Timers. Timer myTimer = new System. Timers. Timer (60000); // judge every minute
MyTimer. Elapsed + = new System. Timers. ElapsedEventHandler (OnTimedEvent); // code for executing the operation. OnTimedEvent is the name of the method to be executed.
MyTimer. Interval = 60000;
MyTimer. Enabled = true;
}
Void Application_End (object sender, EventArgs e)
{
// Code that runs when the application is closed
}
Void Application_Error (object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
Void Session_Start (object sender, EventArgs e)
{
// The code that runs when the new session starts
}
Void Session_End (object sender, EventArgs e)
{
// The code that runs when the session ends.
// Note: Only the sessionstate mode in the Web. config file is set
// The Session_End event is triggered only when InProc is used. If the session Mode
// If it is set to StateServer or SQLServer, this event is not triggered.
}
Private static void OnTimedEvent (object source, System. Timers. ElapsedEventArgs e)
{
// Write the required operations in this method
}