asp.net script in task scheduler

最后都变了- 提交于 2019-12-02 17:38:43

问题


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"



来源:https://stackoverflow.com/questions/4559978/asp-net-script-in-task-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!