This article describes implementing something like the scheduled tasks for Windows, in a Web application, and this can be used without permissions from the administrator.
I was working on an ASP.NET application and they required me to solve a problem of calling a web page at 12:00 PM everyday to do something.
Using the code
It's very simple. It uses a file placed on c:\named uRL.txt.
This file describes what a program will do, and other details, like:
In this example:
- NotePad.exe, is the application you want to invoke. It could be "Explorer" or "Internet Explorer" or whatever program you want to open.
- The second parameter here is the file to open: c:\Mytestfile.txt. It could be a URL like this: http://MySite.com, if you want IE to open it for you.
- 36000 - this is the time interval in seconds, 36000 if you want it to check each hour.
- 17 - this is the start time specified in a 24 hour clock.
- 12000 - this is the time to wait to close the program.
Dim IE As System.Diagnostics.Process()
IE = Process.GetProcessesByName(strProgramName)
Dim i As Integer
Dim IE1 As System.Diagnostics.Process
For i = 0 To IE.Length - 1
IE1 = IE.GetValue(i)
Function checker() As Boolean
Dim currentHour As Integer = DateTime.Now.Hour
If currentHour >= Integer.Parse(strDailyInterval) _
And currentHour < Integer.Parse(strDailyInterval) + 1 Then
checker = True
checker = False
Points of Interest
It can be used in an ASP.NET application, or for remotely controlling PCs on a LAN. Place the URL.txt at any path, then you can load whatever site, or execute any program on the remote PC.
Hope you like it. I will be glad to see your comments in the forum below :).