As from your question tag I assume you want to do this in ASP.Net.
First of all understand that ASP.Net is based on
request - response[
^] model. There are few ways to implement scheduling(Execute some code at specified time) in ASP.Net code.
1. Create and start
timer instance in
Global.asax Application_Start event. On each timer tick event do what you want to do.
I do not recommend this way, as it is bad idea to write timer functionality in ASP.Net.
2. Write
scheduling windows service to call a web service.
i. Write the code that you want to execute on specified time in a web service.
ii. Write a windows service to call this web service at specified time.
You can use
Quartz.net[
^] for this purpose.
I recommend this strategy
3. If you are hosting your website in shared environment like on shared hosting space, then you may use
SQL Job schedule to execute a code periodically.
i.
SQL Job Scheduler[
^]
ii.
http://msdn.microsoft.com/en-us/library/ms191439.aspx[
^]
4. Else give a thought to
Windows Task Scheduler
i.
Windows Task Scheduler[
^]
ii.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa383614(v=vs.85).aspx[
^]
Hope this helps.
All the best.