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?
Thanks
AutomaticSlimAsked:
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.

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

Sub Form_Load()

Show
Doevents
Webbrowser1.Navigate2 "http://www.url.com/file.asp"

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

Try use the URLDownloadToFile API

Example:

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()
    Randomize
    rndkey = Int(Rnd * 100000")
    URL = "http://www.abc.com/pass_management/user_auth.php?name=USERNAME&pass=PASSWORD" & "&rndkey=" & rndkey
    DownloadFile URL , "c:\test.txt"
End Sub

also:

Ensuring URLDownloadToFile Bypasses a Cached File Copy
http://vbnet.mvps.org/code/internet/urldownloadtofilenocache.htm

FYI, by download a file by url is same as run/call that page.
0
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?
0
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?
0
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)

        Try
            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
0
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 "http://www.something.com/test.asp"   
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.
0
Erick37Commented:
Try this...

WebBrowser1.Navigate2 "http://www.microsoft.com"

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

'Unload the form and the program ends
Unload Me
0

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
Erick37Commented:
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 "http://msdn.microsoft.com"
    Do While ie.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop
    Debug.Print ie.StatusText
    Debug.Print ie.LocationName
    Debug.Print ie.LocationURL
    ie.Quit
    Set ie = Nothing
End Sub

0
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.

Example:

Inet1.OpenURL url

cheers
0
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.