Hi guys,

as per title above,
im at my wits end after a week of thoughts....
i want to download a file from a SSL web to my local(C:\)

e.g https://www.abc.com/File/myfile.txt

from the web browser(Internet Explorer), i required to login to the site in order to download the file.

in the vb program i pass in this url to download the file (include my password and username):
but what has been downloaded to my C:\ is the login page(in myfile.txt)

but when i use the url on the web browser(https://www.abc.com?Login&password=pass&username=usr&redirectto=File/myfile.txt
i managed to get the file (the actual file).

is there anyway that i can download the file from a login page?
do you get what i mean?


8 Years
Discussion Span
Last Post by koh

>i want to download a file from a SSL web to my local(C:\)
Think about WebRequest class. Read sknake's post - http://www.daniweb.com/forums/thread203253.html

Thanks for your reply :D
but im using webrequest class as welll....
but it doesnt seems working....
i compared the code as described and my code..
about the same.
Is there something need to be done on the login session?

anyway, here is my code,
thanks :D

Dim wr As HttpWebRequest
        Dim ws As HttpWebResponse
        Dim str As Stream
        Dim inBuf(1000000) As Byte
        Dim bytesToRead As Integer = CInt(inBuf.Length)
        Dim bytesRead As Integer = 0
        Dim request

        request = WebRequest.Create(sRemoteUrl)
        wr = CType(request, HttpWebRequest)
        ws = CType(wr.GetResponse(), HttpWebResponse)

        str = ws.GetResponseStream()
        While bytesToRead > 0
            Dim n As Integer = str.Read(inBuf, bytesRead, bytesToRead)
            If n = 0 Then
                Exit While
            End If
            bytesRead += n
            bytesToRead -= n
        End While
        Dim fstr As New FileStream(sFile, FileMode.OpenOrCreate, FileAccess.Write)
        fstr.Write(inBuf, 0, bytesRead)

Thanks for your guys' url/article.
The only missing is the cookie session.
Really appreciate your guy's assistance :D

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.