Because the Global File Created by WebSite is built-in by default and is not in appcode, it cannot be accessed. In this case, we need to manually modify it.
<% @ Application Codebehind = "App_Code \ Global. cs" Inherits = "Global" Language = "C #" %>
Then add the Global class to app_code.
Using System;
Using System. Collections. Generic;
Using System. Web;
Using System. Web. Security;
Using System. Web. SessionState;
Using System. Timers;
Public class Global: System. Web. HttpApplication
{
Public static Timer aTimer = new Timer ();
Protected void Application_Start (object sender, EventArgs e)
{
Global. aTimer. Elapsed + = new ElapsedEventHandler (aTimer_Elapsed );
}
Void aTimer_Elapsed (object sender, ElapsedEventArgs e)
{
System. Data. DataTable ds = MySqlDB. GetChangesOnLdapServer ();
If (ds. Rows. Count> 0)
{
MySqlDB. AddNewUser (ds );
}
}
Protected void Session_Start (object sender, EventArgs e)
{
}
Protected void Application_BeginRequest (object sender, EventArgs e)
{
}
Protected void Application_AuthenticateRequest (object sender, EventArgs e)
{
}
Protected void Application_Error (object sender, EventArgs e)
{
}
Protected void Session_End (object sender, EventArgs e)
{
}
Protected void Application_End (object sender, EventArgs e)
{
}
}