Call an ASP file from an vb EXE

I want to make an .EXE file that I can shadule to run daily.
When this file gets executed I want it to run/call an .ASP page.
How can I do this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Add a reference to "Microsoft Internet Controls" from the Project->References menu.
Place a Webbrowser control on your form.

Sub Form_Load()

Webbrowser1.Navigate2 ""

end Sub
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
try use URLDownloadToFile API, like:

Try use the URLDownloadToFile API


Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    Dim lngRetVal As Long
    lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    If lngRetVal = 0 Then DownloadFile = True
End Function

Private Sub Form_Load()
    rndkey = Int(Rnd * 100000")
    URL = "" & "&rndkey=" & rndkey
    DownloadFile URL , "c:\test.txt"
End Sub


Ensuring URLDownloadToFile Bypasses a Cached File Copy

FYI, by download a file by url is same as run/call that page.
AutomaticSlimAuthor Commented:
I have vb 6.0  Do I need .Net for any of the above? I coulden't get any of the examples to work.
Is there any more detail steps that I need to know?
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

AutomaticSlimAuthor Commented:
Do I need to have the code in a Module or Form if I want the program to be an exe?
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
For .Net version (VB.NET), try:

'Get Web Page Content
    Public Function getURLDownload(ByVal URL As String) As String
        Dim tmp As String

        Dim req As System.Net.WebRequest = System.Net.WebRequest.Create(URL)

            Dim result As System.Net.WebResponse = req.GetResponse()
            Dim ReceiveStream As System.IO.Stream = result.GetResponseStream()

            Dim read() As Byte = New Byte(512) {}
            Dim bytes As Integer = ReceiveStream.Read(read, 0, 512)

            While (bytes > 0)
                Dim encode As System.text.Encoding = System.Text.Encoding.GetEncoding("utf-8")
                tmp = tmp & encode.GetString(read, 0, bytes)
                bytes = ReceiveStream.Read(read, 0, 512)
            End While

            Return tmp
        Catch Exc As Exception
            Return ""
        End Try
    End Function
AutomaticSlimAuthor Commented:
Ok This is what I did:

Ctrl + T  and then I added "Microsoft Internet Controls" .
Next I added this to my Form
then I inserted this code:

Private Sub Main()
    WebBrowser1.Navigate2 ""   
End Sub

When I run this the Form opens and loads the page and runs the asp.
But now the form stays open on the screen, I want to close everything after it is ran the asp.
Try this...

WebBrowser1.Navigate2 ""

'Wait here until document loads
Do While WebBrowser1.ReadyState <> READYSTATE_COMPLETE

'Unload the form and the program ends
Unload Me

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you do not need a user interface, then add the following code to a Module.  It creates an instance of InternetExplorer and navigates to the specified page.  Then quits.  No references or controls needed.

Option Explicit

Sub main()
    Dim ie As Object
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Navigate ""
    Do While ie.ReadyState <> READYSTATE_COMPLETE
    Debug.Print ie.StatusText
    Debug.Print ie.LocationName
    Debug.Print ie.LocationURL
    Set ie = Nothing
End Sub

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Find a better way maybe, that's using M$ Internet Transfer Control ActiveX (you can select it from Components), where it got a method called openURL which do exact the same above to retrive data from an URL.


Inet1.OpenURL url

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.