<%@ application Language= "C #"%>
<%@ import namespace= "System.Data"%>
<%@ import namespace= "System.Data.SqlClient"%>
<%@ import namespace= "System.Collections"%>
<%@ Import namespace= "System.IO"%>
Introducing Class Libraries
<script runat= "Server" >
Add by Chairuirui 2013-3-26
void Application_Start (object sender, EventArgs e)
{
Code to run when the application starts
System.Timers.Timer MyTimer = new System.Timers.Timer (60000); Every minute, judge.
mytimer.elapsed + = new System.Timers.ElapsedEventHandler (ontimedevent); Execute code that requires action, Ontimedevent is the name of the method to execute
Mytimer.interval = 60000;
Mytimer.enabled = true;
}
void Application_End (object sender, EventArgs e)
{
Code to run when the application shuts down
}
void Application_Error (object sender, EventArgs e)
{
Code to run when an unhandled error occurs
}
void Session_Start (object sender, EventArgs e)
{
Code to run when a new session is started
}
void Session_End (object sender, EventArgs e)
{
The code that runs at the end of the session.
Note: Only the sessionstate mode in the Web. config file is set to
InProc, the Session_End event is not raised. If the session mode
is set to StateServer or SQL Server, the event is not raised.
}
private static void Ontimedevent (object source, System.Timers.ElapsedEventArgs e)
{
The required actions are written in this method
}
In the Application_Start method in the global file: Timer