System.Timers
using System.Web; using System.Web.Security; using System.Web.SessionState; using System.Timers; using System.IO; using System.Threading; namespace WebApplication1 { public class Global : System.Web.HttpApplication { public static System.Timers.Timer timer1 = new System.Timers.Timer(); protected void Application_Start(object sender, EventArgs e) { timer1.Interval = 100; timer1.Elapsed += timer1_Elapsed; } void timer1_Elapsed(object sender, ElapsedEventArgs e) { timer1.Stop(); // Set the time here // Example: 6 hours Thread.Sleep(6 * 60 * 60 * 1000); // Do something. Example: File.AppendAllText("C:\\log.txt", DateTime.Now + "\r\n"); } } }
WebApplication1.Global.timer1.Start();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)