Hi,
How can I call to a ASP.NET file (.aspx) from a VBS file that are both on the SAME server ?
I need that the VBS file will execute the asp.net file with some parameters.
Thanks
Hi,
How can I call to a ASP.NET file (.aspx) from a VBS file that are both on the SAME server ?
I need that the VBS file will execute the asp.net file with some parameters.
Thanks
something like this?
Dim ie
Set ie = CreateObject("internetexplorer.app location")
ie.Navigate "http://www.mysite.com/mypage.aspx?q=1"
ie.Visible=True
or
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "iexplore http://www.mysite.com/mypage.aspx?q=1", 9
WScript.Sleep 10000 ' Give ie some time to load
'Close the browser
WshShell.SendKeys "%F"
WshShell.SendKeys "C"
or
rebember that you run web pages directly from the Task Scheduler and use curl
You can use ServerXMLHttp:-
dim xhr : set xhr = CreateObject("MSXML2.ServerXMLHttp.3.0")
xhr.open "GET", "http://yoursite/youcode.ashx?params=x", false
xhr.send
if xht.status = 200 then
msgbox "Success :)"
else
msgbox "Failed :("
You can use the following in your .vbs file
Set winHttpRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
winHttpRequest.Open "GET", "http://localhost/mypage.aspx", false
winHttpRequest.Send
WScript.Echo(winHttpRequest.GetAllResponseHeaders())
WScript.Echo(winHttpRequest.ResponseText)
For more examples, see http://www.neilstuff.com/winhttp/
You should be able to call any URL (including .aspx pages) on your server (or on the internet)