asp.net script in task scheduler

2019-03-04 13:27发布

问题:

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

回答1:

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')


回答2:

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.



回答3:

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"