Click here to Skip to main content
14,365,424 members

.NET WebScheduler for scheduled downloading of web sites and files through HTTP and FTP

Rate this:
3.36 (8 votes)
Please Sign up or sign in to vote.
3.36 (8 votes)
28 Oct 2005
An article describing a ScheduledTask class for writing a WebScheduler application, for example a Windows Service.


Ever wanted to create a web application that sends reminder e-mails every week? Or that cleans up a remote images or articles folder? Or to backup a certain FTP folder every night or week? This document describes a ScheduledTask class written by David van Leerdam for use in (for example) a Windows Service that you can run to accomplish these tasks for you.


When you're hosting your own applications, scheduling events for your web server is not a real challenge. But it is an issue when your (for example, ASP.NET or PHP) application is hosted by a third party which does not allow running of home grown timers, schedulers, Windows Services etc. A possible solution is to run the (web) scheduler on a remote machine, for example, a machine at home or at the office, which is always online. This is also great for remotely creating backups of websites through FTP.

Using the code

The solution consists of two parts:

  1. An application, a Windows Service (or whatever) that references the WebScheduler assembly (see downloads).
  2. The WebScheduler assembly containing the ScheduledTask class.

For part 1, I assume you will be creating a Windows Service (see downloads for sample code). All the code my Windows Service contains is:

Protected Overrides Sub OnStart(ByVal args() As String)
        sites = ScheduledTask.GetAll()
        For i As Integer = 0 To sites.Count - 1
            Dim st As ScheduledTask = sites(i)
    Catch ex As Exception
        EventLog.WriteEntry("WebScheduler", _
          "An exception occurred. " & ex.ToString())
    End Try
End Sub

Protected Overrides Sub OnStop()
        For i As Integer = 0 To sites.Count - 1
            Dim st As ScheduledTask = sites(i)
    Catch ex As Exception
        EventLog.WriteEntry("WebScheduler", _
          "An exception occurred. " & ex.ToString())
    End Try
End Sub

The result of the GetAll() method is an ArrayList containing all the tasks defined in the config file.

Tasks are defined using a config file (currently hard coded to reference c:\WebScheduler.config). This example contains a task definition for creating a backup of every night at 0:45 A.M.:

<?xml version="1.0" encoding="utf-8" ?>
     <task id=""







            password="p4ssw0rd" />

Note that any configured path to a folder (i.e. not a file) needs to end with '\'. This is applicable to both local and remote paths.

Points of Interest

A few changes are required to make this component more reliable:

  • What happens when the config file is updated while a task is being executed is to be researched.
  • Further attempts should be made when a request or a complete task fails.

All suggestions, bug reports, code updates, refactorings etc. are welcome. Please leave me a message at the bottom of this page so that I can update the article.

Consuming application

I will keep a list of applications that consume this component or parts of it. Please leave me a message so that I can list your application!

  • My own SchedulingService application, see downloads.


  • 19 October 2005: Updated the article with version 0.2 of the code. Some major changes include a better FTP component (version 1.2.2 of edtFTP.NET), config format adjustments, and bug fixes. Minor adjustments where made in terms of performance and refactoring.
  • 1 February 2005: Posted the article with version 0.1 of the code.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

David van Leerdam
Web Developer
Netherlands Netherlands
I am a .NET developer for a large European IT consultancy company.

Comments and Discussions

Questionhow do i set this up on my local machine? Pin
FlipsideDevelopments15-Sep-08 0:25
memberFlipsideDevelopments15-Sep-08 0:25 
QuestionHow to implement in my application. Pin
Umesh87383-Mar-08 20:45
memberUmesh87383-Mar-08 20:45 
Generalcopy of new version Pin
ninja_scroll23-Aug-07 0:56
memberninja_scroll23-Aug-07 0:56 
Generalcould u pls send me the latest update Pin
ravi kanthi24-Jun-07 19:35
memberravi kanthi24-Jun-07 19:35 
GeneralAn update on the article/project's progress [modified] Pin
David van Leerdam8-Sep-06 4:38
memberDavid van Leerdam8-Sep-06 4:38 
General[Message Removed] Pin
Mojtaba Vali26-Oct-05 11:10
memberMojtaba Vali26-Oct-05 11:10 
GeneralRe: opensource Pin
David van Leerdam26-Oct-05 21:08
memberDavid van Leerdam26-Oct-05 21:08 
GeneralUnable to Download source code Pin
PSK_1-Jun-05 23:24
memberPSK_1-Jun-05 23:24 
GeneralRequest Pin
Phaniraz14-Feb-05 20:46
memberPhaniraz14-Feb-05 20:46 
GeneralRe: Request Pin
Anonymous14-Feb-05 22:49
memberAnonymous14-Feb-05 22:49 
GeneralRe: Request Pin
Anonymous15-Feb-05 1:42
memberAnonymous15-Feb-05 1:42 
GeneralRe: Request Pin
Anonymous15-Feb-05 5:40
memberAnonymous15-Feb-05 5:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 4 Feb 2005


41 bookmarked