I got small asp.net script what could be executed as web page
http://localhost/myscript.aspx
and I need this script to be run every 30 seconds.
I am working on windows server 2003 with IIS 6.0 I got task scheduler available, however launching iexplorer.exe http://localhost/myscript.aspx open browser even putting JavaScript windows.close () inside page, so in a few min I will have too many browsers open
how to run it similar to Unix Lynx http://localhost/myscript.aspx > null
Install PowerShell then you can create a task that runs the following command:
powershell.exe -c (new-object system.net.webclient).downloadstring('http://localhost/myscript.aspx')
I would instead start a background thread in the Application_Start event and then use a timer object to trigger the action every 30 Seconds in this background thread.
save your vbs file,
Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "iexplore your url", 9
WScript.Sleep 20000 ' Give ie some time to load
'Close the browser
WshShell.SendKeys "%F"
WshShell.SendKeys "C"
来源:https://stackoverflow.com/questions/4559978/asp-net-script-in-task-scheduler